Bayern Munich came from behind to beat Hertha Berlin 3-2 at the Allianz Arena and maintain their place at the top of the Bundesliga.
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 Goetze's first goal for Bayern 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.
Ramos gave a bold Berlin side the lead in the fourth minute when he headed Per Skjelbred's cross in from a central position.
Hertha nearly doubled their lead in the 10th minute when Ben-Hatira looked to lob Manuel Neuer, succeeding in beating the Bayern goalkeeper, but was thwarted by the crossbar.
From the rebound, Ramos tried to turn the ball in, but Daniel van Buyten came to his goalkeeper's rescue.
It did not look like it was going to be Bayern's day when Toni Kroos and Arjen Robben both limped off the field in quick succession, being replaced by Mario Goetze and Mandzukic.
Guardiola stuck the Croatian forward at the top of his team, pulling Thomas Muller back into midfield, and within five minutes, he had brought Bayern level.
Franck Ribery sent in a free-kick from the right to the far post where Mandzukic was perfectly placed to nod the ball in.
The second half started like the first, with Hertha going close. Tolga Cigerci's shot was deflected over the crossbar by Bastian Schweinsteiger, warning Bayern that the game was not going to be any easier in the second 45 minutes.
Ramos headed over as Hertha continued to pose a threat, but the next goal came at the other end, and it was almost identical to their equaliser with Mandzukic heading in a free-kick, this time from Schweinsteiger.
Guardiola's other substitute Goetze then gave Bayern a more comfortable lead as he followed up his first goal for the club in the Champions League in midweek with his first Bundesliga goal, a header past Thomas Kraft.
Hertha tried to make a game of it with Ben-Hatira reducing the arrears in the 58th minute from Nico Schulz's cross.
They had the defending champions retreating for the remainder of the game, but were unable to find an equaliser.