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 side 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.
Tweets of the match
The Robins tweeted one of their much talked about goal GIFs when they took the lead, depicting Reid letting off a fire extinguisher. Their hosts then sent out a GIF of their own when equalising, featuring a figure wearing the Blues' home shirt, clenching both fists in celebration, with a 'smiling face with sunglasses' emoji superimposed over the head.
Star man - Frank Fielding
There were hugely commendable performances throughout the visitors' team, and goalkeeper Fielding certainly had a fine evening. One point-blank stop to deny Raheem Sterling was particularly impressive.
View from the dugout
Although this first leg eventually ended in defeat, Bristol City boss Lee Johnson can only be immensely proud of what he saw from his players. They produced another memorable display against top-flight opposition, having already seen off Watford, Stoke, Crystal Palace and Manchester United in the competition this term - and one that means they are still very much in the tie ahead of the second leg at Ashton Gate in a fortnight.
Guardiola saw his men far from at their best, but it must be acknowledged that it was another decent show of character from the quadruple-chasing Blues to still manage to come through this distinct off-night with a victory.
Visiting boss Lee Johnson felt his side did themselves proud at the Etihad Stadium - and revealed they earned some high praise from City boss Pep Guardiola at full-time.
"Obviously I'm disappointed with the goal so late on, but the boys were magnificent," he said.
"I thought it was fascinating we came here and played our own game and we caused a few problems.
"It's only half-time and we're still well in the tie.
"I said to the boys, 'you've been fantastic'. Yes we rode our luck every now and again, of course we did, but we broke, we got men in the box (and for) the lead up to our goal the pressing was amazing.
"The boys can't be disappointed as we're still in the tie. We showed the world we're a good football team.
"Pep Guardiola said to me that we played better than the majority of Premier League teams that have come to Man City.
"We showed a good account of ourselves. I think the away goal is very important.
"We tried to score. We certainly didn't park the bus."
Guardiola added: "They are a fantastic team. That's why they knocked out four Premier League teams. Without that they will not be in the semi-final.
"They can play, long balls, they are fast, they know exactly what they have to do.
"Of course we will attack in Bristol and we're going to try and win."