Hertha Berlin secured their place in the Bundesliga for next season with a 2-0 away win at Hamburg on Monday to take the promotion/relegation play-off 2-1 on aggregate.
"That is a huge relief. What the boys did was outstanding," said Hertha sports director Fredi Bobic.
An early headed goal by Hertha captain Dedryck Boyata and a speculative second-half free-kick from Marvin Plattenhardt saw Hertha turn their fortunes around in Monday's return leg.
Hertha had lost the first leg 1-0 in Berlin last Thursday, but the visitors flew out of the traps in Hamburg when Boyata smashed in a header after just four minutes.
Falling behind subdued the hosts, who lacked the composure of the first leg.
Only a superb save by Hamburg goalkeeper Daniel Fernandes blocked a fierce shot by Hertha striker Ishak Belfodil with half-time approaching.
Hamburg rallied after the break with right-back Moritz Heyer testing Hertha goalkeeper Oliver Christensen with a long-range shot.
At the other end, Fernandes pulled off a brilliant save at the near post to block a shot by Plattenhardt, but the dead-ball specialist who was not to be denied.
The Germany defender launched a stunning free-kick from the left flank to the far post which curled over Fernandes and into the net on 63 minutes.
The goal put Hertha ahead on aggregate for the first time in the play-off tie as the visitors hung on despite increasing desperation from the Hamburg team.
Hertha finished with ten men when Lucas Tousart was shown a second yellow card just before the final whistle as tempers flared in stoppage time.
After nine straight seasons in the Bundesliga, Hertha avoided their first relegation since 2011/12.
The aggregate defeat denied Hamburg a return to Germany's top flight after four seasons since their 2018 relegation.
Hertha's caretaker coach Felix Magath, 68, who won Bundesliga titles in charge of Bayern Munich and Wolfsburg, has kept the Berlin club up despite winning just three of his nine games in charge.
"We are massively grateful for what Felix has done, striking the right key to get the best out of the team," added Bobic.
As a player, Magath scored Hamburg's winning goal in the 1983 European Cup final win over Juventus and won three Bundesliga titles with the north German club.
Hamburg qualified for the play-off by finishing third in the second division while Hertha ended up third from bottom of the Bundesliga.