Pierre-Emerick Aubameyang's last-gasp penalty earned Dortmund an automatic place in next season's Champions League.
Bayern Munich gave Philipp Lahm and Xabi Alonso a fitting send-off with a comfortable win over Freiburg.
Luca Waldschmidt scored one day after his 21st birthday for Hamburg to clinch Bundesliga survival with a late 2-1 win over Wolfsburg.
Pierre-Emerick Aubameyang's penalty handed Borussia Dortmund a 4-3 win over Werder Bremen to clinch direct qualification into the Champions League.
Philipp Lahm and Xabi Alonso received standing ovations as Bayern Munich sent two of modern football's maestros into retirement on a winning note.