It puts the onus back on surprise-package RB Leipzig, who drop to second on goal difference but can reclaim top spot on Saturday with a draw or victory at home to mid-table Schalke.
German champions Bayern looked back to their best after a poor run by their high standards that saw them lose at Borussia Dortmund and then Russia's Rostov in the Champions League.
Bayern Munich announce record turnover
They got back on track by beating Bayer Leverkusen 2-1 last weekend and were good value for the three points at Mainz, who stunned the Bavarians last season on Bayern's way to the Bundesliga title.
Friday's game was preceded by a minute's silence for the victims of this week's plane crash in Colombia that wiped out the Brazilian team Chapecoense.
The visitors were caught cold however after just four minutes when Jhon Cordoba -- a Colombian -- scored at Opel Arena to thrill most in the 34,000 crowd.
Champions League Matchday 5: The tops and flops
Carlo Ancelotti's men reacted, with Franck Ribery wasting an opportunity before prolific Polish striker Lewandowski made it 1-1 on eight minutes.
Misfiring Thomas Mueller twice squandered opportunities to increase Bayern's lead, but on 21 minutes Dutch wing wizard Arjen Robben -- who had set up the equaliser for Lewandowski -- made it 2-1 when he headed home.
Robben, making his 150th Bundesliga appearance, should have made it 3-1 minutes later but he poked over when through on goal.
The second half was all Bayern but it took until injury time for them to make the pressure count, Lewandowski stepping up to curl the ball beautifully into the top corner from a free-kick that he had won.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ