BERLIN (AP) — Paderborn and Freiburg were relegated from the Bundesliga on the last day of the season Saturday, while Hamburg clinched the relegation playoff spot and Stuttgart stayed up.
Daniel Ginczek was the hero for Stuttgart, scoring in the 72nd minute for a 2-1 win over Paderborn that left the home side bottom and saved his own.
Paderborn had to win to have any hope of avoiding the drop and Marc Vucinovic got the promoted side off to a great start by scoring in the fourth minute.
But Daniel Didavi equalized in the 36th for Stuttgart and Ginczek lifted the side to safety with the decisive goal.
"It's a perverse situation. One team is celebrating, the other has to go to the second division," Stuttgart captain Christian Gentner said.
Freiburg lost 2-1 at Hannover, which stayed up through Japan midfielder Hiroshi Kiyotake's third-minute header and an 84th-minute own goal from Pavel Krmas. Nils Petersen's injury-time strike was too late for Freiburg.
"The club is a small one, but a great one in its way," Freiburg coach Christian Streich said. "We'll survive and come back."
Hamburg, the only team never to have been relegated from the Bundesliga, has another chance to remain in the topflight after second-half goals from Ivica Olic and Slobodan Rajkovic secured a 2-0 win over Schalke at home.
"Today in the stadium was the pinnacle, goose bumps, great atmosphere," Hamburg coach Bruno Labbadia said. "You could see what can be achieved when you work together."
Hamburg now faces a two-legged playoff against the third-place finisher from the second division to determine which side plays in the top flight next season. That will be one of Darmstadt, Karlsruher SC or Kaiserslautern — all former sides of Labbadia from his playing career.
Borussia Dortmund defeated Werder Bremen 3-2 in coach Juergen Klopp's last home game to qualify for the Europa League.
"It was one of the best stories in football I've ever heard about," Klopp said of his seven seasons in charge.
Japan midfielder Shinji Kagawa opened the scoring after a great run from Ilkay Gundogan in the 15th and Pierre-Emerick Aubameyang — who earlier hit the post — made it 2-0 two minutes later.
Levin Oztunali pulled one back with his first goal for Bremen in the 26th, but Henrikh Mkhitaryan made it 3-1 on a counterattack in the 42nd after controlling Kagawa's looped cross and finishing with confidence.
Theodor Gebre Selassie's 85th-minute goal proved just a consolation for Bremen, which slipped to 10th place.
Dortmund finished seventh, enough for the Europa League even if it loses the German Cup final against Wolfsburg next Saturday. The winner qualifies for Europe. Wolfsburg has already qualified for the Champions League so if it wins the final, the extra qualification place goals to the seventh-place finisher in the league.
Bayern Munich, which clinched the title with four games to spare, ended its three-game losing streak with a 2-0 win over visiting Mainz.
Robert Lewandowski scored a penalty in the 25th for his 17th goal of the season, two off Alexander Meier's total for Eintracht Frankfurt. Meier, currently injured, finished as the league's top-scorer.
Bastian Schweinsteiger celebrated his 500th competitive game for Bayern by scoring in the 48th, and Bayern was presented with the "salad bowl" league trophy after the game, prompting confetti and beer-shower celebrations.
Also, Wolfsburg drew 2-2 at Cologne to finish second, third-place Borussia Moenchengladbach lost 3-1 at Augsburg, which finished fifth, and fourth-place Bayer Leverkusen lost 2-1 at Frankfurt, which finished ninth.
Hoffenheim defeated Hertha Berlin 2-1 at home. Hertha finished level on points with Hamburg but out of the relegation zone on goal difference.