Former Bundesliga champions Werder Bremen avoided relegation from the German top flight on away goals after a 2-2 draw at second division Heidenheim.
Bremen were last relegated to the second tier for the 1980-81 season, which is the only campaign they have spent out of the Bundesliga.
The first leg of the promotion-relegation play-off had ended 0-0.
In the second leg, Bremen twice took the lead before holding on for a draw which kept them up.
Heidenheim defender Norman Theuerkauf’s early own goal gave Bremen the lead and it took the home side until the 85th minute to equalise through Tim Kleindienst.
Ludwig Augustinsson restored the visiting side’s lead with a 94th-minute strike and, despite Kleindienst scoring a penalty eight minutes into stoppage time, Bremen celebrated securing their Bundesliga status.
“I’m just happy and glad that we made it after all that,” said Bremen coach Florian Kohfeldt.
“We were dead so many times this year, we always came back. Every criticism was justified, but chapeau to the boys.”