Bundesliga Wrap: Bayern dent Hamburg hopes
Bayern went into the match following a humiliating 5-0 aggregate UEFA Champions League semi-final loss to Real Madrid, but Hamburg could not make the most of the visitors' dejected mood.
Mirko Slomka's side needed a victory to have any chance of avoiding a bottom-three finish, but the Bundesliga champions' quality eventually shone through despite Hamburg threatening early on.
Mario Gotze, who is reportedly unhappy at the Allianz Arena, gave Bayern the lead just after the half-hour mark to round off a delightful one-two with Arjen Robben and Thomas Muller got their second 10 minutes after the break.
Former Borussia Dortmund star Gotze doubled his tally with just over 20 minutes to go, before Hakan Calhanoglu pulled one back for the hosts
Claudio Pizarro's audacious overhead-kick finish 15 minutes from time ended any chance of an unlikely Hamburg comeback, before Jerome Boateng received a late red card for an altercation with Kerem Demirbay.
The loss for Hamburg means that they can now only finish the season as high as 16th, which would see them face a relegation play-off, but they could still suffer automatic demotion.
Schalke consolidated their place in third with a win at Freiburg, moving them on to 61 points, three ahead of Bayer Leverkusen in fourth and four better off than fifth-placed Wolfsburg.
Kaan Ayhan put Schalke ahead in the 13th minute before Klaas-Jan Huntelaar doubled their lead 20 minutes into the second period as they cruised to victory.
Felipe Santana's red card 17 minutes from time for two bookable offences put Schalke's position in doubt, but there was to be no late fightback from the hosts.
Bayer Leverkusen remain in pole position for fourth after goals from Gonzalo Castro and Emre Can earned Sascha Lewandowski's men a 2-0 triumph at Eintracht Frankfurt.
Borussia Monchengladbach secured Europa League football for next season with a 3-1 home win against Mainz, while Wolfsburg's hopes of a Champions League spot remain alive as they beat Stuttgart 2-1 away from home.
Despite the loss to Wolfsburg, Stuttgart are now safe from relegation as neither Hamburg nor Nurnberg could muster a victory, with the latter stumbling 2-0 at home to Hannover.
Eintracht Braunschweig retain some hope of avoiding an automatic relegation and clinching the play-off place, but their last-gasp 1-0 defeat to visitors Augsburg means they go into the season's final match in last place.
Hoffenheim found themselves involved in another high-scoring match as they lost 3-2 at Borussia Dortmund in Robert Lewandowski's Signal-Iduna-Park farewell, while Werder Bremen beat Hertha Berlin 2-0 at home in a mid-table clash.