Bayern trailed at the half-time interval after Shawn Parker grabbed a shock opener just before the break at the Allianz Arena.
The Bavarians responded in the second half with Arjen Robben and Thomas Muller turning the game on its head in the space of two minutes.
Mario Mandzukic added a third before Muller's second - this time from the penalty spot - completed the rout to lift the champions back to the summit
after they had been displaced on Friday night when Bayer Leverkusen won 2-1 at Hoffenheim.
Guardiola was, however, left concerned by his team's worrying trend to get out of the blocks slowly.
"I'm pleased with the result, (but) we've always had problems in the first half here at the Allianz Arena," he told the club's official website.
"We need to improve on that very soon, and I'm certain we will.
"I was calm at half-time. We made a few changes to our formation and Arjen moved over to the left."
Philipp Lahm believes Bayern's early malaise could have been due to players returning from the international break, but admitted they must cut out their slow starts.
"We really, really struggled in the first half and we tended to lack concentration," he said.
"It happens frequently after international breaks, and we need to get a grip on it as soon as we can.
"We switched things around a little after that and it paid off. But credit to Mainz, they made life very difficult for us."
Mainz coach Thomas Tuchel admitted his side, who sit 13th, had been over-run in the second half.
"We're a 1970 model VW Beetle, up against a Formula 1 car, so it's normal to be overtaken before the end," he said.
"But nothing went wrong, quite the opposite. We had a huge chance on the break when the score was 1-0, but we played the move very badly.
"Then we lost concentration a few times in defence."