Hoffenheim will remain in the Bundesliga next season after their 2-1 win at Kaiserslautern in Monday's promotion/relegation play-off, second leg.
Danish defender Jannik Vestergaard's late header sealed a 5-2 aggregate win which preserves Hoffenheim's status in Germany's top flight.
After they won the first-leg 3-1 at home last Thursday, thanks to two first-half goals from Brazilian striker Roberto Firmino, Hoffenheim took the lead at Kaiserslautern's sold-out Fritz Walter Stadium.
Argentinian defender David Abraham headed home just a minute before the break.
The hosts drew level when ex-Bayern Munich midfielder Alexander Baumjohann crashed home a direct free-kick on 65 minutes.
But Vestergaard popped up with the winner when he headed home from eight metres after a cross from Bosnia midfielder Sejad Salihovic.
"I think we were very focused and well prepared for what awaited us here," said Hoffenheim coach Markus Gisdol, who only took charge last month after predecessor Marco Kurz was sacked.
"We allowed them very little and sought out our chances.
"I think over the two legs, we were the better team.
"Despite only having been together for a short time, we have found each other and become a team."
Having been second from bottom in the Bundesliga since February, Hoffenheim only escaped automatic relegation on the last day of the season on May 18.
Their shock 2-1 win at Champions League finalists Borussia Dortmund meant Hoffenheim finished 16th to qualify for the play-off against Kaiserslautern, who finished third in the second division.
The 2013/14 season will be Hoffenheim's sixth in Germany's top-flight, while defeat means Kaiserslautern remain in the second division.