José Mourinho ended this breathless contest on his knees with a sliding, turf-surfing celebration that was fuelled by relief as much as joy. Until Cristiano Ronaldo dropped a hip to remove Pablo Zabaleta and dipped a shot from the left that Joe Hart should have saved, the Real Madrid manager had witnessed a frantic close that threatened a week-long inquisition into him and his team.

"The celebration doesn't matter," he said. "What matters is the match and the way people who love football enjoyed this for sure."

Mourinho's promise that "the best" Real Madrid would turn up had appeared empty. In this collision of more than half a billion pounds worth of talent, first Edin Dzeko then Alexsandar Kolarov scored goals that appeared to seal for Manchester City a memorable victory.

Real, as their pedigree should, answered. A Marcelo curler beat Hart for a first equaliser before Karim Benzema answered Kolarov's strike and Ronaldo stepped up to grab the glory as the world's second-best player should.

On a sultry night in the Spanish capital City began the starriest occasion of their quest to join the game's aristocrats. Fourteen years ago minus a day Chesterfield had been the opposition at Maine Road in the third tier when a point was scraped against 10-man opposition thanks to a Lee Bradbury equaliser.

Now, as the flashlights popped and the Bernabéu howled, Vincent Kompany led out a Manchester City squad that had cost £321m to challenge a Real vintage whose price stands at £385m.

This was City's second attempt at establishing themselves as a continental force. After last year's campaign ended before Christmas the pressure is on Roberto Mancini to take his cash-soaked millionaires into the knockout stage at least.

The headline team news consisted of Matija Nastasic being preferred to Joleon Lescott in central defence for a debut to remember, and for Real, Michael Essien beating Mesut Ozil, Luka Modric and Kaka to a place in Mourinho's 4-3-2-1 formation that had Ronaldo marauding from the left.

This was the first home game for Madrid since Ronaldo declared himself unhappy. While the theory runs that the No 7's disquiet is due more to pay-rise jockeying than a love deficit of the Bernabéu, his performances have not lost lustre despite Madrid's poor start to La Liga.

His winner here was met by a joy that has been missing following recent goals. "I celebrate when I have to celebrate. The match was very important and we are in the fight," he said. Of his "sadness", Ronaldo added: "That is not important, the important thing is that we won. It was a very good game, for those who like to see."

In the opening 15 minutes the Portuguese put on a show full of darting runs and ever more menacing assaults on Hart's goal, as City soaked up the expected onslaught from the nine-time European Cup winners who have not won this competition for a decade.

The closest the contest came to a goal in the first half-hour were two chances for Madrid. The impressive Angelo Di Maria sprayed the ball wide and, when Ronaldo cut in, a bullet of a shot was saved by Hart with a sideways starfish leap.

The same manoeuvre rescued City moments later. Di Maria flipped a quarter-back's pass over the defence at Gonzalo Higúain, but a clumsy touch allowed Hart to spread his frame and smother the ball.

For City there were a couple of surging Yaya Touré runs plus a move involving Maicon that looked to exploit what has been Madrid's defensive Achilles heel this season: an aerial vulnerability that a Mourinho XI does not usually feature. This moved him to drop Sergio Ramos to the bench for the 19-year-old Raphael Varane but, when Maicon crossed, the Frenchman and Pepe had problems with the delivery.

This was about it for City, with Carlos Tevez having scant sight of the ball in his lone-striker role. Yet 0-0 at half-time would have pleased Mancini. Despite Di Maria again setting up Higúain with another spooned pass, he could not finish. So, although Samir Nasri had limped off with a hamstring injury that will see him out for up to four weeks, this had been a successful first period for the visitors.

Kolarov, who would be so central at the end, was Nasri's replacement and he was called into duty early in the second half – a sliding block preventing Di Maria from receiving the ball in front of Hart.

Ronaldo had been missing in action since his initial surge. A quick shoe-shuffle and release to Marcelo that the left-back zipped across the goal-face suggested he was re-entering the contest. Moments later it was Ronaldo's run and cross that caused Gaël Clichy problems as Di Maria looked to pickpocket him, as the pattern of Real dominance continued.

And, of course, re-entering the contest Ronaldo certainly was, as his last-minute winning goal dramatically testified.