Manchester City lived dangerously before emerging with a point as Middlesbrough produced a performance that offers them real hope of escaping from the relegation zone in their final three games.
It could have been even worse for City, who were in danger of going down to a defeat when Guardiola would have been the only man to blame after choosing to leave Raheem Sterling and Leroy Sane on the bench.
They twice trailed to goals from Alvaro Negredo and Calum Chambers, but a controversial penalty by Sergio Aguero and a late header from Gabriel Jesus kept City ahead of rivals Manchester United in the race for a Champions League place.
If Guardiola wanted a pre-match boost for his players, Swansea provided it by taking a point at United since it meant a victory here would take City three points clear of their rivals in the tussle for the priceless final Champions League spot.
It is so tight that goal difference could be crucial and City went into this game with a two-goal advantage over United and a chance to extend that margin, a chance that they failed to take.
However, they were up against a Middlesbrough defence with 11 clean sheets to their credit this season - one more than Guardiola’s team.
Middlesbrough problems have been at the other end of the pitch. Even with the presence of former City favourite Negredo, Boro had managed just 24 goals going into this game - one them coming when they drew at the Etihad Stadium earlier in the season.
They also met at the Riverside in March when City eased to an FA Cup victory, an example of their excellent away form which has brought a club record of 11 victories in the league.
Sergio Aguero scored for City in both of those games and, while Middlesbrough did not need a reminder of his threat, they got it after a mere 45 seconds when he drilled a shot across the face of the goal.
But the first-half did not develop as many Middlesbrough fans must have feared after the opening minutes. Buoyed by their win of 2017 in midweek. Steve Agnew’s matched City’s possession for the opening 45 minutes even if they did not utilise it in the same accomplished style.
They still created an excellent opportunity in the 13th minute for Negredo, the Spanish striker who won the Premier League title with City in 2014.
He dragged his shot across goal where Cristhian Stuani was inches away from taking advantage, perhaps prompting City fans to wonder whether - at 31 - Negredo still carries a goal threat. The answer came in the 38th minute at the end of a superb, sweeping move.
George Friend started it with an interception on the edge of his own and broke before finding Marten de Roon, whose early measured pass sent Stewart Downing galloping down the left.
Friend, who simply kept running, got a touch on the cross, taking the pace off the ball and leaving Negredo with the chance for a shot on the turn that went inside Willy Caballero’s post.
Now the questions began about Guardiola’s decision to leave out Sterling and Sane and he as good as accepted he had made a mistake by sending the pair on after only five minutes of the second-half in place of Garcia and Gael Clichy.
Their impact was immediate as City raised the tempo and soon forced a save from Brad Guzan as he beat away a fierce effort from Kevin de Bruyne.
Middlesbrough, who started the half with an Adam Clayton effort that was comfortably dealt with by Caballero, were now finding it difficult to get out of their own half neat footwork by Sane created another chance for de Bruyne, who sliced it well wide.
The mounting pressure eventually brought its reward in the 69th minute from Aguero’s penalty, although Middlesbrough’s fans will never be convinced it was the correct decision by referee Friend as Sane went down under a challenge from Marten de Roon.
De Roon had to be held back as he tried to argue with the referee before Aguero converted the penalty and set a frantic final 20 minutes when Boro’s fans mercilessly jeered Sane whenever he touched the ball, which was often.
Middlesbrough went in front again in 78th minute and Caballero was a fault as he failed to hold Downing’s free-kick. City had chances to clear, but Negredo helped keep the ball inside the area and Chamber eventual poked it past the keeper from close-range.
But Jesus had the final word when he headed in after 85 minute and immediately raced to the touchline to shake the hand of Guardiola.