Reigning German champions and finalists in last season’s Champions League, Bayern had to wait until the 43rd minute to take the lead.
Michael Kessel had twice gone close for the amateur team before German international Miroslav Klose put Bayern ahead by acrobatically converting a cross from Diego Contento.
France winger Franck Ribery doubled the advantage two minutes later to put the Bavarian giants 2-0 up at the change of ends.
It was not until the game’s closing stages that Bayern’s class began to shine through, with strikes from Toni Kroos (in the 84th minute) and Mario Gomez (85) finally putting the game beyond their opponents.
Bayern, who will be without injured Dutch winger Arjen Robben until October, begin their German title defence in the opening game of the Bundesliga season against Wolfsburg on Friday.
“It’s always hard to have maximum concentration against a small team, but it’s our worst match since the start of pre-season,” said Bayern coach Louis van Gaal. “We should also give credit to our opponents, who played very well for 90 minutes. We did what we had to do, that’s all.”
Two Bundesliga clubs have already fallen to lower league opposition in the first round of the German Cup, with St Pauli losing 1-0 to fourth-division Chemnitz and Hanover knocked out on penalties by fourth-tier Elversberg.