Carlo Ancelotti's men suffered an exit from the Champions League at the quarter-final stage in midweek, losing 6-3 on aggregate to Real Madrid in controversial circumstances, Arturo Vidal harshly sent off in the second leg while two of Cristiano Ronaldo's goals appeared offside.

Though their European campaign ended in disappointment, Bayern have appeared on course for another procession to the Bundesliga title for some time, but Leipzig can now cut the gap at the top to six points by beating Schalke on Sunday, with the top two still to play each other in the penultimate game of the season.

The hosts appeared to have a Champions League hangover when Mainz took the lead in the third minute through Bojan Krkic, his first goal since joining on loan from Stoke City.

Franck Ribery set up Arjen Robben to restore parity, but Bayern shot themselves in the foot before the break, Daniel Brosinski converting from the penalty spot for Mainz following Joshua Kimmich's foul on Yoshinori Muto.

Thiago Alcantara denied Mainz a win that would have boosted their survival hopes, but Bayern could not complete the comeback and have the added worry of a David Alaba injury to deal with ahead of Wednesday's DFB-Pokal semi-final with Borussia Dortmund.

Bayern shockingly fell behind as they were punished for sloppy defending, a miserable week for Vidal continuing as he conceded possession to Bojan, who evaded the challenge of Thiago before firing low underneath Sven Ulreich.

Muto then saw a cross deflected onto the top of the net as Mainz pressed to double their advantage, and a second would have arrived had Ulreich not produced a fine one-on-one save to deny Levin Oztunali after a quick counter.

And Mainz's inability to take that chance was punished as Ribery and Robben combined in trademark fashion, the Frenchman laying off for the Netherlands winger to fire across the face of goal and in.

But Bayern were dealt a blow immediately after the leveller as Alaba was withdrawn through injury, Kimmich replacing him at the back.

Robert Lewandowski had an opportunity to complete the turnaround, but was unable to get a touch on a centre from Thomas Muller.

Muller then had a chance to put Bayern ahead himself, only to flash a fierce drive past the post after a rapid break from Robben, before Bojan blasted high and wide from just inside the area.

However, Mainz retook the lead five minutes before half-time as Brosinski converted from 12 yards.

Muto was felled by Kimmich and Brosinski snuck his effort underneath Ulreich's right hand and into the bottom corner.

Ulreich could have done better in his efforts to save the spot-kick and he was at fault again as Alexander Hack saw a goal-bound effort blocked after the Bayern goalkeeper had failed to claim a ball into the box.

Ribery was replaced by Kingsley Coman at half-time and Bayern began the second half looking reinvigorated.

Coman stung the palms of Huth with a long-range drive, but Mainz continued to frustrate Bayern until the 73rd minute when Thiago levelled matters, firing a low effort in off the left-hand post.

Referee Frank Willenborg waved away penalty claims after a risky challenge on Lewandowski by Hack, but Mainz dealt with the late pressure from Bayern with little difficulty to give Leipzig a little more reason for hope in their title pursuit.