For Manchester City it would have been easy to think this was set to be another of those frustrating Champions League matches, when the little details were against them, when their best attacking efforts came to nothing.

Pep Guardiola’s team were looking comfortable despite the loss of their key defender, Aymeric Laporte, to injury in the first half and then, out of nowhere, they were behind. The concession was grisly, with Kyle Walker guilty of losing out to Vinícius Júnior and following a quick pass, Isco was in to finish.

Real Madrid were flat throughout, lacking inspiration, but they are a team who know how to get the job done. They seemed ready to guard a 1-0 lead to take to the Etihad Stadium in three weeks’ time.

Sergio Ramos and his 26 Real Madrid red cards: a retrospective Read more

Yet City were not finished. Far from it. They had sensed vulnerability in Real and during a glorious finale, they made their punches count. This was a victory of spirit and style and it was triggered by Gabriel Jesus, who had gone close and refused to believe he would end up on the losing side.

Kevin De Bruyne dug out an excellent cross from the byline which evaded Sergio Ramos and asked Jesus to attack it. He did and his header eluded Thibaut Courtois. Real’s cries for a foul by Jesus on Ramos were in vain. The striker had his reward for a display of remorseless intensity.

Guardiola’s selection had featured several headlines, one of them being the omission of Raheem Sterling from the starting lineup. The forward, who was fit after hamstring trouble, was bitterly disappointed but having been sent on for the final push, he helped to make the difference, driving away from Dani Carvajal to be chopped down for a penalty.

Sergio Agüero, Jesus and Ilkay Gündogan have all missed from the spot for City this season and so De Bruyne accepted the responsibility. The nerves of the travelling support jangled but De Bruyne was a snapshot in composure and when he sent Courtois the wrong way, it was the prompt for City’s hopes to surge.

The club have won only four knock-out ties in nine seasons in this competition but the fifth is within their grasp, and the cold truth for Real was that they could already have been staring at the exit door.

Facebook Twitter Pinterest Gabriel Jesus scores Manchester City’s first goal. Photograph: Alex Livesey - Danehouse/Getty Images

The team Guardiola called the kings of the Champions League had Ramos sent off towards the end for a last-man foul on Jesus, giving Riyad Mahrez the chance to score with a free-kick from the edge of the area, which he passed up. City had done the same earlier. Jesus, for example, was off target from a Mahrez cross.

But to quibble about profligacy is to overlook the body of City’s work, the way they put the pain of their looming two-year ban from European football for financial irregularities behind them to produce one of their finest nights. Had the punishment bonded them more tightly? Guardiola said not, although it was tempting to argue against him.

Guardiola had surprised everyone by resting Fernandinho, Sterling and Agüero, while his 4-4-2 system featured Jesus on the left flank, even though he played through the middle for the opening few minutes, and De Bruyne and Bernardo Silva as the central attackers.

The idea was for the unlikely strike duo to set a high press, with Mahrez and Jesus making the pitch wide – to use Guardiola’s description.

There were also times when De Bruyne and Silva dropped deeper to allow the other two to push up as split strikers. For the first 15 minutes City struggled but they would grow into the game, with their rhythm not disrupted by the loss of Laporte. Fernandinho filled in seamlessly.

City could be pleased at how they kept Real at arm’s length before the interval, although they did give up one clear-cut chance. Karim Benzema found space to head Ferland Mendy’s cross towards the corner and it took an excellent save from Ederson to keep him out. Vinícius looked the favourite to reach the rebound only to slip at the crucial moment.

Real Madrid 1-2 Manchester City: Champions League last 16, first leg – live! Read more

City had the better of a limited crop of first-half chances, with Jesus missing the big one after taking a De Bruyne pass and jinking inside. His shot was too close to Courtois. There was also the moment on 45 minutes when Jesus shot low after Courtois had flapped at a corner. The ball almost went in off Ramos before Real smuggled it off the line.

The value of an away goal was always going to be huge and City came close to it at the start of the second-half. First De Bruyne led a break and played in Jesus, who curled the ball wide of the top corner, and then Mahrez found space behind the defence following a ball over the top. He probably had more time than he realised but rushed the shot and saw the Real goalkeeper block.

Isco’s goal was a complete surprise, leading to Real enjoying an inspired but brief patch as City looked downbeat. How they would clamber to their feet.