Bayern Munich came from behind for an eighth successive Bundesliga match as the champions overcame struggling Mainz 5-2 at the Allianz Arena.
Hansi Flick's side have not taken the lead in a league game since October and might have been staring down the barrel of a second defeat of the season had Danny Latza beaten Manuel Neuer early in the second half.
Mainz had a 2-0 lead at that stage, with Jonathan Burkardt and Alexander Hack scoring in the first half, but Joshua Kimmich and Leroy Sane restored parity in the space of five minutes.
Robin Quaison struck the woodwork as 17th-placed Mainz fought back, though Bayern ultimately had too much.
Niklas Sule's deflected strike and Robert Lewandowski's double – the first of which came from the spot – settled a thrilling contest firmly in Bayern's favour.
Against the run of play, Mainz struck first – Burkardt getting the better of Jerome Boateng and thumping beyond Neuer.
Bayern were convinced Boateng had been fouled, but the VAR disagreed, though Mainz's lead would have been swiftly cancelled out had Finn Dahmen not palmed over Lewandowski's strike.
But Bayern were dealt another blow before the interval, Hack capitalising on some dreadful marking to head home from Daniel Brosinski's free-kick.
Latza should have put Mainz out of sight three minutes after the restart, only to drill straight at Neuer from point-blank range, and the visitors were punished when Kimmich headed in from Lewandowski's flick.
Bayern quickly doubled down – Sane cutting in from the right to curl in a crisp, low finish.
Neuer's crossbar came to Bayern's rescue from Quaison's blistering shot and the hosts made their fortune count as Sule's volley skewed in off a defender a few moments after Leandro Barreiro's own goal was disallowed for Alphonso Davies straying offside.
Barreiro's luck ran out in the 74th minute when he wildly scythed down Serge Gnabry, giving Lewandowski the chance to wrap up the win.
Having sent Dahmen the wrong way from 12 yards, Lewandowski then met Thomas Muller's cross to add a fifth with seven minutes remaining and send Bayern back to the Bundesliga's summit.