The Bavarian outfit has finished in the bottom two for a record eighth time, while Torsten Lieberknecht's men's stay in the top flight ends after one year.
Hamburg traveled to Mainz for matchday 34 knowing that they needed to match or better both sides' results.
Mirko Slomka's side lost 3-2 but was spared an automatic drop as Schalke and Hoffenheim claimed 4-1 and 3-1 wins over Nurnberg and Braunschweig respectively.
For Nurnberg, this is the club's eighth relegation, claiming outright the record it used to share with Arminia Bielefeld.
Braunschweig, meanwhile, has looked set for the drop all season, having spent the majority of the campaign rooted to the foot of the table.
Hamburg is likely to play Greuther Furth in the relegation playoff after finishing two points clear of Nurnberg and three ahead of Braunschweig.