Bayern Munich defender Daniel van Buyten headed in a cross eight minutes from time to give his team a 2-1 victory over promoted Nuremberg on Saturday and lift them to third place in the Bundesliga.
Germany's record champions have now won three league matches in a row after their worst start of the season in decades and are just two points behind leaders Hamburg SV and Bayer Leverkusen who are on 13 points.
"We did not play very well against a well organised team with a lot of people at the back," Bayern coach Louis van Gaal told reporters.
"If you play such a defensive team then you have to bring the ball into the box and we scored a beautiful goal (through van Buyten). Now we must beat Hamburg next week and then I will be satisfied," the Dutchman said.
Bayern initially found it hard going against a crowded Nuremberg defence but continued to press and it only looked a matter of time until they scored.
Striker Ivica Olic and Thomas Mueller missed clear chances before Mario Gomez thought he had scored in the 31st when his shot bounced off the crossbar onto the line. The referee rightly waved play on.
It took Bayern only nine minutes after the re-start to take the lead when Olic slotted home after Mueller cleverly chipped the ball into the Croatian's path in the box.
Nuremberg surprisingly levelled with a swift attack on 73 minutes when Eric Maxim Choupo-Moting chased down a pass on the right to fire home before Belgian van Buyten rose to head in an Arjen Robben cross for the winner nine minutes later.
Hoffenheim joined Bayern on 11 points after scoring three goals in the final five minutes for a 4-2 win over hosts Borussia Moenchengladbach, who had taken a 2-0 lead.
Brazilian Maicosuel made it 2-2 on 86 minutes before Chinedu Obasi and Demba Ba added two more to complete a stunning comeback for Hoffenheim.
Visitors Cologne beat VfB Stuttgart 2-0 to record the first win of what has so far been a miserable season and move a place above the relegation zone to 15th.
Leaders Hamburg SV take on Eintracht Frankfurt and second-placed Bayer Leverkusen host Werder Bremen on Sunday.