Bayern Munich were twice pegged back by Paderborn, but Robert Lewandowski's late strike sealed the points.
Robert Lewandowski scored a late winner to send Bayern Munich four points clear at the top of the Bundesliga with a 3-2 over bottom side Paderborn.
Hansi Flick's men twice saw a one-goal lead erased by their lowly visitors in an absorbing encounter, with efforts from Serge Gnabry and Lewandowski cancelled out by Dennis Srbeny and Sven Michel.
However, two minutes from the end of normal time Gnabry and Lewandowski combined to seal maximum points for Bayern, albeit in unconvincing fashion.
After avoiding a remarkable slip-up, Bayern can watch the rest of the weekend's action with the pressure firmly on challengers RB Leipzig as they visit Schalke on Saturday looking to reduce the gap back to a point.
Lewandowski spurned two early opportunities to open the scoring for Bayern as he headed narrowly wide and was then unable to connect with Alvaro Odriozola's right-wing ball across the face of goal.
Gnabry atoned for Lewandowski's profligacy, though, as he capitalised on Paderborn's failure to clear their lines, engineering space in the box and finding the bottom-right corner from close range.
However, Bayern were pegged back shortly before the interval as Paderborn levelled in remarkable circumstances.
Srbeny latched onto a ball down the right and made Manuel Neuer pay for his decision to rush from his goal, knocking it through the legs of the goalkeeper before running into the box and dispatching into the empty net after evading David Alaba.
Bayern almost provided an immediate response in fortuitous circumstances, but Corentin Tolisso's deflected cross looped onto the top of the crossbar.
Leopold Zingerle produced heroics to deny Lewandowski twice in less than a minute as Bayern pressed to take control in the second half.
First the Paderborn keeper tipped over a venomous drive from the Poland international, before getting down low to scramble away his header from the resulting corner.
Lewandowski finally beat Zingerle when Gnabry got to the byline and pulled back for him to slot home, but Paderborn swiftly restored parity on the break.
Neuer could only palm Dennis Jastrzembski's near-post effort into the path of Michel, who needed no second invitation to tap in the rebound.
Yet there was to be in a sting in the tail and it came as Lewandowski got on the end of a perfectly placed Gnabry cross to settle matters with his 25th league goal of the season.
What does it mean? Bayern send the wrong message
A home game against a relegation-threatened side was an ideal opportunity for Bayern to deliver a statement of intent with an emphatic victory.
They did the important part in getting the win that keeps Leipzig at arm's length, but the nature of the triumph and their vulnerability at the back should give confidence to their title challengers and to Champions League last-16 opponents Chelsea.
Gnabry marks milestone in style
Making his 100th Bundesliga appearance, Gnabry was instrumental for Bayern, playing a part in every goal in a performance that underlined his importance to the side.
Neuer picks wrong time to rush
Known for his willingness to operate well outside the confines of his area, Neuer played the role of rush keeper perfectly for most of the first half.
However, he got it all wrong in laying Paderborn's first equaliser on a plate with the type of mistake that could fuel further debate over his position as Germany's number one.
Bayern make the trip to Stamford Bridge on Tuesday before visiting Hoffenheim in the league four days later, when Paderborn travel to fellow strugglers Mainz.