Karlsruher 1-2 Hamburger (2-3 aet)
Hamburg scored a 90th-minute equaliser to force extra time before extending their 52-year Bundesliga stay with a 3-2 aggregate win over Karlsruher.
After Marcelo Diaz's curled free-kick cancelled out Reinhold Yabo's composed finish, Nicolai Muller turned in with the tie five minutes from penalties.
Karlsruher saw a 120th-minute penalty saved but Hamburg would have won on away goals had Rouwen Hennings scored.
Hamburg remain the only Bundesliga club never to have been relegated.
The north German club have been ever-present since the league was formed in 1963, and last season narrowly came through another relegation play-off against Greuther Fuerth, winning on away goals.
And after finishing 16th in the league table again this year, Bruno Labbadia's side had to play Karlsruher, who finished third in the second-tier 2. Bundesliga.
Thursday's first leg ended 1-1 and Karlsruher went ahead in the tie when Yabo slotted home through Rene Adler's legs.
The home side were moments away from promotion when Diaz curled home his first ever Hamburg goal in the last seconds of normal time.
Having forced extra time, six-time German champions Hamburg, who had former Tottenham midfielders Rafael van der Vaart and Lewis Holtby in their starting XI, all but ensured victory with a second goal that left Karlsruher needing to score twice.
Hennings' penalty, awarded for handball amid protests from the Hamburg players, was then saved by goalkeeper Adler, playing against his former club.