Match ends, 1. FSV Mainz 05 3, Hamburger SV 2.
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.
- 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
Second Half ends, 1. FSV Mainz 05 3, Hamburger SV 2.
Substitution, 1. FSV Mainz 05. Niko Bungert replaces Yunus Malli.
Tomás Rincón (Hamburger SV) wins a free kick on the right wing.
Foul by Junior Diaz (1. FSV Mainz 05).
Attempt blocked. Milan Badelj (Hamburger SV) left footed shot from outside the box is blocked.
Milan Badelj (Hamburger SV) wins a free kick in the attacking half.
Foul by Julian Baumgartlinger (1. FSV Mainz 05).
Foul by Marcell Jansen (Hamburger SV).
Stefan Bell (1. FSV Mainz 05) wins a free kick in the defensive half.
Foul by Ivo Ilicevic (Hamburger SV).
Zdenek Pospech (1. FSV Mainz 05) wins a free kick in the defensive half.
Goal! 1. FSV Mainz 05 3, Hamburger SV 2. Ivo Ilicevic (Hamburger SV) right footed shot from the centre of the box to the bottom right corner. Assisted by Petr Jiracek with a cross.
Attempt blocked. Hakan Calhanoglu (Hamburger SV) left footed shot from the centre of the box is blocked. Assisted by Marcell Jansen.
Substitution, 1. FSV Mainz 05. Julian Baumgartlinger replaces Elkin Soto.
Substitution, Hamburger SV. Marcell Jansen replaces Rafael van der Vaart.
Substitution, 1. FSV Mainz 05. Nicolai Müller replaces Koo Ja-Cheol.
Goal! 1. FSV Mainz 05 3, Hamburger SV 1. Shinji Okazaki (1. FSV Mainz 05) left footed shot from the centre of the box to the high centre of the goal. Assisted by Yunus Malli.
Attempt saved. Tomás Rincón (Hamburger SV) right footed shot from outside the box is saved in the centre of the goal.
Corner, Hamburger SV. Conceded by Christoph Moritz.