Sergio Aguero denied Bristol City a hard-earned draw in the EFL Cup semi-final first-leg with a last-minute header
Manchester City needed a late Sergio Aguero winner to claim a 2-1 advantage from the first leg of their Carabao Cup semi-final against Bristol City.
The runaway Premier League leaders were given a stern test by the Championship side and fell behind to a Bobby Reid penalty after 44 minutes at the Etihad Stadium.
Pep Guardiola's men created numerous chances in a strong response but, after Kevin De Bruyne's well-worked 55th-minute equaliser, they had to wait until substitute Aguero headed in a Bernardo Silva cross in injury time.
The Robins, for whom goalkeeper Frank Fielding was outstanding, deserved to take something from the game and their away goal may give them some hope for the return at Ashton Gate.
Initially, the visitors struggled to get the ball but, when they did come by it, they showed they would not be intimidated.
They attacked with pace and confidence with Joe Bryan, scorer of a spectacular goal against Manchester United in the quarter-finals, often leading the charge.
Hordur Magnusson's long throw-ins also proved a handful with one delivery into the box eventually falling for Jamie Paterson to shoot. John Stones blocked.
Bryan tried his luck himself after De Bruyne lost the ball and Marlon Pack also hit a shot from the edge of the area but Claudio Bravo saved both efforts.
The hosts were not at their incisive best with Aguero on the bench and Raheem Sterling, Bernardo Silva and Leroy Sane switching roles across the attacking line.
Openings did come, however, with Sane twice bringing Fielding into action and De Bruyne also having a shot tipped over.
Ilkay Gundogan also missed the target twice and Silva badly miscued in front of goal.
Eliaquim Mangala played the home side into trouble when he lost the ball to Josh Brownhill. Reid took up the attack and was crudely brought down in the area.
Bravo did get his fingers to the resulting spot-kick but could not keep out Reid's firm strike.
That spurred the Premier League leaders into life and Sterling looked set to level before the break when he lifted over the advancing Fielding but Aden Flint scrambled back superbly to head off the goalline.
Fielding parried as Sterling went close again early in the second half but the Championship side could not hold out much longer as Guardiola's men increased the tempo.
Bravo launched the quick break that led to the equaliser with a pass that found De Bruyne in a huge amount of space.
The Belgian did not pass up the invitation and charged the length of the field before exchanging passes with Sterling and thumping home the leveller.
With the hosts threatening more, some rough tactics were employed to halt the momentum and Flint, Korey Smith and Bryan were all booked in quick succession.
It did not stop the flow, however, and Fielding needed to save well to repel Sterling before Sane shot wide.
Lee Johnson's men then sat back, getting bodies behind the ball at every opportunity to cling on for a draw.
It almost worked but Aguero had the final say on the night two minutes into stoppage time.