Berlin: Stuttgart secured their promotion to the Bundesliga after only one season away while Hamburger SV wasted any chance of a return from Germany's second division in the final round on Sunday.
Stuttgart finished runner-up, 10 points behind already promoted Arminia Bielefeld, despite a 3-1 loss at home to Darmstadt. Former Germany striker Mario Gomez scored Stuttgart's goal in his last game for the club.
"I am in negotiations with Real and BarÃ§a, and if nothing comes of that..." Gomez joked.
"It was my last mission for Stuttgart after we messed up last year (with relegation) to go back up again this year. My intention was to go then," said Gomez, who will be 35 on 10 July.
Hamburg started one point behind third-place Heidenheim. With a superior goal difference, a draw would have been enough for Hamburg to capitalise on Heidenheim's 3-0 defeat at Bielefeld and finish in the promotion playoff spot. But former Bundesliga heavyweight Hamburg slumped to a 5-1 loss at home to SV Sandhausen, which only had pride to play for on the final day.
"There's no excuse," Hamburg president Marcell Jansen said.
Former Hamburg midfielder Dennis Diekmeier scored Sandhausen's fifth goal to rub salt in his former side's wounds. It was only his second goal all season.
Hamburg were the last team to have played every season of the Bundesliga since the league was founded in 1963 until "der Dino" as they are affectionately known was finally relegated after a number of close calls in 2018.
Heidenheim next faces a two-leg playoff against Werder Bremen, which finished third from last in the Bundesliga, to see which side plays in the top flight next season.
"There was no happiness after the game, just disappointment with defeat today," Heidenheim coach Frank Schmidt said. "Now we'll lick our wounds and get ready for Bremen."
Nuremberg, who was relegated from the Bundesliga last season, dropped third from last in the second division after a 1-1 draw at Holstein Kiel, meaning Nuremberg must win a playoff against a third-division team to avoid a second straight relegation. Their opponent is not yet known.