Adrian Ramos gave the visitors the lead in the fourth minute and they could have stretched that advantage before Mario Mandzukic brought Bayern level.
A further Mandzukic effort and Mario Gotze's first goal for the champions in the Bundesliga appeared to have given Bayern a comfortable win, but Anis Ben-Hatira set up a grandstand finish in which the Bavarians only just held on.
Borussia Dortmund remain hot on their heels after avenging two recent derby defeats with a 3-1 win over local rivals Schalke.
Pierre-Emerick Aubameyang gave Jurgen Klopp's men the lead in the 14th minute before Kevin-Prince Boateng missed the chance to equalise from the penalty spot.
Nuri Sahin doubled Dortmund's lead in the 51st minute before Max Meyer reduced the arrears, but Jakub Blaszczykowski guaranteed victory for the Black and Yellows.
Bayer Leverkusen are also just a point behind the leaders after they came from behind to beat Augsburg 2-1.
Andre Hahn put the visitors in front with an eye-catching volley but Leverkusen worked their way back into the game with captain Simon Rolfes levelling and Emre Can grabbing a winner.
Roberto Firmino scored two goals as Hoffenheim bounced back from their "ghost goal" loss to Leverkusen with a convincing 4-1 victory at Hannover, who finished with just nine men on the pitch.
Sejad Salihovic gave Hoffenheim the lead in the 10th minute and the hosts lost their first player two minutes later when Mame Biram Diouf saw his second warning. Kai Herdling doubled the lead after 18 minutes.
Salif Sane halved the deficit for Hannover in the 56th minute but Firmino tallied in the 62nd and 64th minutes to decide the game. Marcelo was sent off for Hannover in the 64th minute.
Shinji Okazaki scored two goals as Mainz finally returned to winning ways with a 2-0 victory at home over bottom side Eintracht Braunschweig.
The Japan international scored in the eighth and 68th minutes as Mainz ended a six-match winless streak.
In the day's late game, Wolfsburg moved into fifth place thanks to a
comfortable 3-0 win over Werder Bremen in a one-sided northern Germany derby.
Maximilian Arnold put the hosts on their way to victory in the eighth minute,
but they had to wait until late on to confirm their superiority with further
goals from Ivica Olic and Ivan Perisic wrapping up victory for Dieter Hecking's
Bremen hardly managed to test Wolfsburg goalkeeper Diego Benaglio as they
remained in 12th place, three points behind the Wolves.