Pep Guardiola's side put their midweek UEFA Champions League defeat against Manchester City behind them by stretching their long unbeaten run to 41 league games.
Mario Mandzukic put the home side in front three minutes before half-time, then further strikes from Mario Gotze and Xherdan Shaqiri ensured Bayern head to next week's FIFA Club World Cup on the back of a win.
Pierre-Michel Lasogga had made it 2-1 three minutes from time, but Hamburg head into the mid-season break on the back of a second defeat in four Bundesliga games.
Third-placed Borussia Dortmund lost further ground on the leaders after drawing 2-2 at Hoffenheim.
Jurgen Klopp's side looked to be heading for a defeat when Sven Schipplock and Kevin Volland put Hoffenheim in command at 2-0.
However, Pierre-Emerick Aubameyang pulled a goal back just before half-time and Lukasz Piszczek equalised midway through the second half to thwart the home side.
Dortmund are now 12 points behind the European and German champions and level on points with Borussia Monchengladbach, who were held to a goalless draw at Mainz.
Wolfsburg are fifth and just three points behind Dortmund and Monchengladbach after beating Stuttgart 3-1 on Saturday evening.
Dieter Hecking's side have now won their last three games in all competitions after goals from Ricardo Rodriguez, Diego and Ivan Perisic saw off Stuttgart, who were back in the game at 2-1 when Timo Werner was on target.
Augsburg heaped more misery on Eintracht Braunschweig by beating the bottom side 4-1.
Andre Hahn scored a quickfire first-half double after Paul Verhaegh opened the scoring from the penalty spot, then Halil Altıntop rubbed salt in Eintracht's wounds with a fourth goal 15 minutes from time.
Mame Biram Diouf scored twice in the last three minutes as Hannover mounted a thrilling fightback to come back from 3-0 down and hold Nuremberg to a 3-3 draw.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.