Bundesliga top scorer Pierre-Emerick Aubameyang snatched a last-gasp winner to give Borussia Dortmund a nail-biting 4-3 victory over Werder Bremen 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. The win moved Dortmund, which twice came from a goal down, two points clear of fourth-placed Hoffenheim, and secured more than 12 million euros in guaranteed revenues from Europe's premier club competition. Hoffenheim, which drew 0-0 against Augsburg, will now go into the Champions League qualifying rounds. "The boys kept on delivering, they never lost sight of our target," said Dortmund coach Thomas Tuchel. Goals from Marco Reus and Aubameyang cancelled out Zlatko Junuzovic's early lead but Werder scored either side of the break to go 3-2 ahead. Two penalties, from Reus and from Aubameyang a minute from the end, turned the game in the host's favor. Dortmund faces Eintracht Frankfurt in the Berlin final next week. 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 its runaway fifth successive title triumph by 15 points. Carlo Ancelotti's side finished on 82 points, with Leipzig, which 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, its first European foray in 25 years. Hertha Berlin, sixth on 49 points, will also play in Europe despite being thrashed 6-2 by Bayer Leverkusen while the Europa League ambitions of Freiburg, seventh on 48, is 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. — Reuters