BERLIN (AP) — Wataru Endo scored in injury time for Stuttgart to clinch Bundesliga survival at Hertha Berlin’s expense after a dramatic 2-1 win over Cologne in the final round on Saturday.

Endo’s 92nd-minute winner lifted Stuttgart ahead of Hertha on goal difference to set off scenes of jubilation with fans storming the field.

Hertha lost at Borussia Dortmund 2-1. Youssoufa Moukoko’s late winner for Dortmund sent Hertha into the dreaded relegation playoff against the second division’s third-place finisher to see which will play in the Bundesliga next season.

Hertha will likely face former Bundesliga heavyweight Hamburger SV on May 19 and 23.

On a day of farewells in the Bundesliga, Erling Haaland also scored for Dortmund and Robert Lewandowski brought his league-leading tally to 35 goals for Bayern Munich, while Arminia Bielefeld was finally relegated to join last-placed Greuther Fürth in the second division.

Bayern sporting director Hasan Salihamidžić confirmed before the league champion’s 2-2 draw in Wolfsburg that Lewandowski wants to leave the Bavarian powerhouse.

Lewandowski, who has been linked with a move to Barcelona, has a contract with Bayern to 2023 but Salihamidžić said he turned down the club’s offer to extend it and said “he would like to do something else.”

Bayern failed to win any of its three games after winning the title.

Haaland, who is joining Manchester City, was applauded by Dortmund fans before kickoff against Hertha. Michael Zorc was also given a fond farewell after 44 years as a Dortmund player and sporting director.

Hertha struck first with a first-half penalty from Ishak Belfodil and Haaland equalized with another in the second half to take his league tally to 22 in 24 appearances this season.

Leipzig secured Champions League qualification in fourth place with a late 1-1 draw in Bielefeld, finishing one point ahead of fifth-placed Union Berlin, which clinched Europa League qualification thanks to Taiwo Awaiyi’s late winner against Bochum for 3-2.

Exequiel Palacios scored in injury time for third-placed Bayer Leverkusen to end Freiburg’s Champions League qualification hopes in a 2-1 win. Leverkusen fans paid tribute to departing managing director Rudi Völler before the match.

In other games with little at stake, Borussia Mönchengladbach routed Hoffenheim 5-1, Mainz drew with Eintracht Frankfurt 2-2, and Augsburg defeated Fürth 2-1.

Gladbach coach Adi Hütter announced after his team's win that it was his last in charge after a mutual agreement with the club not to continue. Augsburg coach Markus Weinzierl also said it was his last.

___

More AP soccer: https://apnews.com/hub/soccer and https://twitter.com/AP_Sports

___

Ciarán Fahey on Twitter: https://twitter.com/cfaheyAP