Mainz 3-2 Hamburg
Hamburg must win a relegation-promotion play-off to escape dropping out of the Bundesliga for the first time.
Mirko Slomka's side were beaten 3-2 at Mainz, but Nuremberg and Eintracht Braunschweig are both automatically relegated after losing.
Hamburg trailed to Elkin Soto's goal before Pierre-Michel Lasogga equalised.
Yunus Mallı and Shinji Okazaki made it 3-1 to Mainz before Ivo Ilicevic's consolation for Hamburg, the only ever-present team in the Bundesliga.
Hamburg will not know until Sunday which second division team they will face in the two-legged play-off.
But they must win that match if they are to remain in the top tier.
Hamburg, who have won seven national titles as well as the 1983 European Cup, were founding members of the Bundesliga in 1963.
However, this has been arguably their worst season since then. Thorsten Fink was sacked as coach in September, with his replacement, Bert van Marwijk, lasting only 143 days before being sacked.
Slomka replaced him in February but has been unable to turn around their fortunes dramatically.
Elsewhere in the Bundesliga on Saturday, Schalke clinched an automatic Champions League place after beating Nuremberg 4-1.
Bayer Leverkusen finished fourth with a 2-1 win over Werder Bremen to qualify for the Champions League play-off round.
Bayern Munich and Borussia Dortmund - who will meet in the German Cup final next Saturday - had already made sure of first and second place.
1. FSV Mainz 05
- 20Díaz Campbell
- 19SotoSubstituted forBaumgartlingerat 83'minutes
- 11MalliSubstituted forBungertat 90+1'minutes
- 13Koo Ja-cheolSubstituted forMüllerat 83'minutes
- 37TescheSubstituted forArslanat 74'minutes
- 20LasoggaSubstituted forIlicevicat 67'minutes
- 23van der VaartSubstituted forJansenat 83'minutes
- Thorsten Kinhöfer
- Shots on Target