Wolfsburg came from behind to beat Hoffenheim 3-1 and secure their place in the Bundesliga next season on a dramatic day at the Rhein-Neckar Arena.
Roberto Firmino put the home side in front in the 49th minute and, with results elsewhere going against the Wolves, they were on the verge of relegation.
A 60th-minute goal from Mario Mandzukic brought them level, but they still needed at least one more goal to be sure of their top-flight status.
Mandzukic obliged in the 73rd minute and Grafite sealed the win five minutes later as Felix Magath's side did enough to end the season two points clear of the relegation zone.
Borussia Monchengladbach claimed a spot in the relegation play-off with a 1-1 draw at Hamburg. Juan Arango put the visitors in front in the 41st minute and on track for a fourth straight win, but Anis Ben-Hatira equalised after 71 minutes. The result means Monchengladbach kept hold of third-bottom spot to go into the two-legged play-off against the third-placed team in the 2.Bundesliga.
Eintracht Frankfurt were relegated to the second division after going down 3-1 at Bundesliga champions Borussia Dortmund.
Sebastian Rode put Frankfurt in front and gave them hope of avoiding the drop early in the second half, but the home side turned the game around to win comfortably, even missing two penalties. Lucas Barrios brought them level in the 68th minute before Robert Lewandowski put them in front just a few minutes later.
Barrios missed his second penalty of the afternoon in the 81st minute, after Marcel Titsch-Rivero was shown the red card for a professional foul, but he had the last word with the third goal in the last minute.
Hanno Balitsch's deflected goal was enough as Bayer Leverkusen beat Freiburg 1-0 to secure second place in the table - and an automatic spot in the Champions League. Balitsch scored the game's only goal in the 45th minute as Leverkusen held on for the runner-up position.
Bayern Munich extended their undefeated streak to nine games with a 2-1 win over Stuttgart but had to settle for a third-place finish. Stuttgart went ahead after 24 minutes through Shinji Okazaki before Mario Gomez equalised in the 37th minute and Bastian Schweinsteiger secured the victory with a goal after 71 minutes.
Hannover rallied for a 3-1 win over Nurnberg to seal a fourth-placed finish and a return to Europe action for the first time in nearly 20 years.
Nurnberg took the lead in the 25th minute through Julian Wiessmeier before Kaim Haggui equalised in the 30th minute. Konstantin Rausch made it 2-1 for Hannover after 60 minutes and Didier Ya Konan finished off the scoring from the spot in the 79th minute.
Kaiserslautern held off battling Werder Bremen 3-2 to conclude a great first season back in the Bundesliga with a thrilling victory at the Fritz-Walter-Stadion. Last season's 2.Bundesliga champions have been one of this campaign's the surprise packages, with three points today ensuring they finish in a highly creditable seventh place.
They took the lead through Adam Nemec on seven minutes before further efforts by Francisco Rodnei and Srdjan Lakic appeared to have the result decided inside half an hour. But Bremen pulled one back through Torsten Frings just before the break and then, after Frings missed a penalty on 52 minutes, got to within a goal when Marko Arnautovic netted.
Two second-half goals saw Europa League qualifiers Mainz come from behind to beat bottom-of-the-table St Pauli 2-1.
Despite securing European football for next year Mainz had lost seven games at home this campaign and it looked like they may lose an eighth after Mathias Lehmann had given Christian Heidel's side the lead just before half-time. But the home side hit back in the second half thanks to an Andre Schurrle penalty and a late Sami Allagui goal.
Cologne finished their season on a high by seeing off Schalke 2-1 for their third straight victory. Milivoje Novakovic put Cologne ahead after 25 minutes and Mato Jajalo made it 2-0 in the 60th minute. Schalke struck the woodwork three times before finally cutting the deficit to 2-1 after 87 minutes through Raul.