The holders were never under any threat at the Imtech Arena as goals from Robert Lewandowski, David Alaba and Franck Ribery inflicted more misery on Josef Zinnbauer's side.
Lewandowski was gifted the opening goal after a mistake by Heiko Westermann in the seventh minute, and Alaba doubled their lead on the stroke of half-time.
Ribery, making his first start of the season after suffering back and knee injuries, made it three early in the second half, albeit with the aid of a deflection off Johan Djourou.
Home goalkeeper Jaroslav Drobny had to be alert to deny Ribery a spectacular second with 17 minutes remaining, but a consolation arrived in the form of Pierre-Michel Lasogga's late header.
Victory sees Bayern keep their hopes of a third successive Pokal title alive, while Hamburg's attentions will turn to league survival.
Hamburg made three changes for the contest, but they were let down by a first-team regular in the seventh minute as Thomas Muller intercepted a misjudged back pass from defender Westermann and fed Lewandowski, who found the net at the second attempt.
The visitors were dominant and Philipp Lahm came close to doubling Bayern's lead on 43 minutes only to be denied at point-blank range by Drobny, but the goalkeeper could do nothing about Alaba's sensational strike a minute later.
Having received a pass from Xabi Alonso, the Austria international pushed forward unchallenged into the Hamburg half, before unleashing a swerving 35-yard effort that a wrong-footed Drobny could not keep out.
Hamburg found themselves three goals behind on 55 minutes as Ribery found the back of the net.
Juan Bernat raced down the left and played a pass into the Frenchman's feet. He cut inside two defenders before seeing a low drive deflect off Djourou on its way in.
Three minutes later it could have been four but the Hamburg keeper got down well to deny Muller, and Manuel Neuer was called into action for the first time on 68 minutes when Lasogga found room 20 yards from goal to hit a powerful effort.
Guardiola rang the changes just after the hour but Bayern continued to press and Ribery was denied a stunning second goal in the 73rd minute.
Substitute Sebastian Rode made good ground down the right and his cross was met by the winger but his technique-laden volley was brilliantly tipped around the post by the goalkeeper.
Hamburg finally got themselves on the scoresheet with five minutes remaining as Lasogga met a Rafael van der Vaart cross at the back post to head beyond Neuer.
The game ended on a sour note as a crowd member ran onto the pitch and appeared to lash out at Ribery, sparking angry reactions from players from both sides, and referee Marco Fritz immediately blew the final whistle after the invader was taken away.
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.