Mainz handed Bayern Munich their first home defeat of the Bundesliga season as they claimed an excellent 2-1 victory at the Allianz Arena on Wednesday.
The visitors took an unlikely lead against the run of play midway through the first half when Jairo Samperio finished off an excellent break.
Arjen Robben eventually found an equaliser just after the hour, but Jhon Cordoba then re-established Mainz's lead four minutes from time with an excellent finish.
With second-placed Borussia Dortmund winning at Darmstadt on Wednesday, Bayern's lead at the top of the table has now been cut to five points ahead of Saturday's Der Klassiker at Signal Iduna Park.
Bayern and Mainz provided their respective starting lineups before kick-off, with Franck Ribery and Medhi Benatia both returning for the league leaders:
FC Bayern English @FCBayernEN
As well as #Ribéry, @MedhiBenatia is back in the starting XI too, the fist time since Zagreb in December. #FCBM05 https://t.co/Mlj6EwLjLF3/2/2016, 6:52:14 PM
Mainz 05 English @Mainz05en
And here is #Schmidt's starting XI for tonight's match. Kick-off under 45 minutes away! #FCBM05 https://t.co/YVqInfM1yR3/2/2016, 6:18:01 PM
The hosts dominated the early exchanges with Mainz making it clear that their plan was to sit back and look to hit Bayern on the counter-attack.
Arturo Vidal almost broke the deadlock in the 13th minute with a splendid volley, but Loris Karius got down well to parry the ball away, and the German goalkeeper made another excellent stop moments later from Juan Bernat.
Mainz defended excellently in the main and took their first opportunity with aplomb when Jairo gave the visitors an unlikely lead in the 26th minute after a lightning counter-attack.
Giulio Donati received the ball wide on the right and sent a brilliant ball across the box that Yunus Malli let run for the onrushing Jairo to smash high past Manuel Neuer.
DW Sports gave some context for how surprising Mainz's opener was:
DW Sports @dw_sports
28' - Only the 6th goal Bayern have conceded at home all season. Jairo Samperio with a simple finish in the box! 0-1! #FCBM053/2/2016, 7:28:08 PM
Bayern were patient in their response and almost drew level just before half-time when Robben cut in from the byline and sent a left-footed shot curling just wide of the post.
Squawka provided the statistics from the opening half:
Squawka Football @Squawka
Bayern 0-1 Mainz HT: Shots: 7-3 Possession: 67%-33% Chances created: 6-2 Pass accuracy: 89%-57% Shock on the cards https://t.co/PSmU9M5d9z3/2/2016, 7:50:12 PM
Pep Guardiola made no changes at the break despite his side trailing, but Mainz boss Martin Schmidt threw on Danny Latza in place of Niko Bungert.
The hosts upped the tempo at the start of the second period, but Mainz almost extended their lead six minutes in, Christian Clemens blasting high and wide after receiving a clever backheel in the box.
Bayern's first change arrived shortly afterwards as Thomas Muller replaced Kingsley Coman, and Vidal then had another long-range effort saved by Karius in the 54th minute.
Bentia headed wide from a dangerous Ribery free-kick in the 62nd minute before Robben finally found Bayern's opener from 25 yards moments later.
He received the ball from Vidal and let fly a low, hard shot that flew into the bottom corner, the excellent Karius finally beaten, per Bundesliga expert Clark Whitney:
Clark Whitney @Mr_Bundesliga
Advantage of having a player like Robben (or 5) on the pitch: You might just get a goal out of thin air. What a strike3/2/2016, 8:25:36 PM
BT Sport Football provided footage of the goal:
BT Sport Football @btsportfootball
"It took something special!" Arjen Robben draws @FCBayern level with a superb low strike against @1FSVMainz05. https://t.co/QVCVvWJXV73/2/2016, 8:37:01 PM
The sparkling Dutchman tried another from a similar distance in the 67th minute, but this time he skied it over the bar.
Bayern pushed for the winner, but Mainz's defence held firm, and the visitors again found the net from almost nowhere when Cordoba turned home a wonderful strike from the edge of the box after Julian Baumgartlinger's neat lay-off.
Bayern searched for an equaliser and caused a few last-minute problems for Mainz as Robert Lewandowski and Vidal had half chances, but the final whistle eventually signalled the end of Bayern's perfect home record this season.