BERLIN (Reuters) - Bundesliga top scorer Pierre-Emerick Aubameyang scored a last-gasp winner to give Borussia Dortmund a nail-biting 4-3 victory over Werder Bremen on Saturday and secure their automatic Champions League group stage spot.
Aubameyang, who scored twice to be crowned top scorer with 31 goals, one ahead of Bayern Munich's Robert Lewandowski, converted an 89th minute penalty in the final round of Bundesliga matches to see Dortmund finish third on 64 points and seal the big European bonus.
It left them two points clear of fourth-placed Hoffenheim, who drew 0-0 against Augsburg and will now go into the Champions League qualifying rounds.
Champions Bayern Munich provided a fitting farewell for retiring captain Philipp Lahm and Spaniard Xabi Alonso with a 4-1 victory over Freiburg to wrap up their runaway fifth successive title triumph by 15 points.
Carlo Ancelotti's side finished on 82 points, with Leipzig, who squandered a two-goal lead to draw 2-2 with Eintracht Frankfurt, ending up second on 67, Dortmund third on 64 and Hoffenheim fourth on 62.
Cologne beat Mainz 05 2-0 to hold on to fifth place on 49 points and a Europa League spot next season, their first European foray in 25 years.
Hertha Berlin, sixth on 49 points, will also play in Europe despite their 6-2 demolition by Bayer Leverkusen while the Europa League ambitions of Freiburg, seventh on 48, are reliant on Dortmund winning the German Cup next week.
Hamburg SV protected their proud record as the only club to have played in Bundesliga every season since its creation in 1963 thanks to Luca Waldschmidt's dramatic 89th minute goal that sealed a 2-1 win over VfL Wolfsburg.
The Wolves, champions in 2009, will now go into the relegation playoff with the third-placed team from the second division.
Reporting by Karolos Grohmann; Editing by Ian Chadband