Jamal Musiala scored twice as Bayern Munich beat a resilient Heidenheim 4-2 to extend its lead to six points in the Bundesliga on Saturday.
Bayern dominated possession from the kick-off and Joshua Kimmich's corner allowed Dayot Upamecano to head home in the 18th minute.
Despite continuing to control proceedings, Bayern failed to extend the lead for the rest of the first half. Alphonso Davies hit the woodwork in the 39th minute, before Heidenheim goalkeeper Kevin Muller tipped Kimmich's long-range effort over the bar moments later.
Heidenheim netted an equalizer in the 50th minute when Mathias Honsak rounded goalkeeper Daniel Peretz to score the visitor's first shot on target.
Bayern responded in style in the 56th minute when Musiala, who subbed in five minutes earlier, had all the time and space to fire the ball into the bottom left-hand corner.
Germany international Leon Goretzka made it 3-1 in the 84th minute with a deflected effort, and it looked as if the host had sealed the deal, but once again Niklas Dorsch took advantage of Bayern's defensive miscue to reduce the deficit.
Musiala finally put the result beyond doubt in stoppage time, latching on to Raphael Guerreiro's through ball.
The result sees Bayern Munich extend its lead atop the table, while Heidenheim remains in 16th place, a relegation play-off spot.
"The first half was very good, the counter-pressing worked very well. In the second half we kept our composure," said Bayern coach Vincent Kompany. "We created a lot of chances, but Heidenheim stayed in the game."
Elsewhere, second-placed Eintracht Frankfurt dropped points in the title race after being held to a 2-2 draw by Augsburg. Defending champion Bayer Leverkusen stayed close on Frankfurt's heels after a 2-1 win over St. Pauli. Leipzig remains in the top four after a 2-0 victory over Holstein Kiel. Werder Bremen beat bottom side Bochum 1-0, and Borussia Monchengladbach drew 1-1 with Borussia Dortmund.
On Friday, Stuttgart rallied from two goals down to beat Union Berlin 3-2.