There were also wins for Paris St Germain, who beat Dynamo Kiev 4-1 on their return to the competition after eight years, newcomers Malaga, who beat Zenit St Petersburg 3-0 and former Champions League holders Porto who won 2-0 at Dinamo Zagreb.
In a clash of ex-European title winners Borussia Dortmund beat Ajax Amsterdam 1-0 while seven-times European champions AC Milan were booed off after a 0-0 home draw against Anderlecht.
Arsenal rode their luck to beat French champions Montpellier 2-1 away after conceding an early penalty.
But the outstanding game of the night was in Madrid where all five goals at the Santiago Bernabeu stadium came in the final 22 minutes with City taking a 1-0 lead through Edin Dzeko before Marcelo equalised six minutes later.
Aleksandar Kolarov put City back in front with a free-kick after 85 minutes which looked like the winner before Karim Benzema equalised in the 87th and Ronaldo, the ex-Manchester United forward, struck in the 90th to bury the visitors.
Real are aiming to become European champions for the 10th time at Wembley Stadium next May and their opening group win, against the odds in the closing minutes, will only boost their confidence after a slow start to their domestic season.
I celebrate when I have to celebrate, a jubilant Ronaldo, who has now scored 151 goals in 151 appearances for Real, said in an interview with Spanish television.
The match was very important for us and we are back in the fight, added the Portuguese international, who took his tally to 39 Champions League goals.
Jose Mourinho, whose side have won only one of their first four La Liga matches, told ITV: Real Madrid can lose matches, Jose Mourinho can lose matches, but my happiness is not just that we got three points, but that my team is back.
PSG, outside contenders for the title after spending more than 200 million euros ($261.11 million) on players since being taken over by Qatari investors a year ago, played superbly and were the biggest scorers on the night, thumping Kiev in Group A.
PSG striker Zlatan Ibrahimovic, who opened the scoring with a first-half penalty, became the first player to score in the Champions League for six different clubs having also netted for Ajax Amsterdam, Juventus, Inter Milan, Barcelona and AC Milan.
It was a dream start to the campaign for PSG with Thiago Silva netting on his debut, Alex making it 3-0 and Javier Pastore wrapping up the victory with a fourth in stoppage time.
PSG were never really threatened by the visitors who got a late consolation through Miguel Veloso.
Carlo Ancelotti's side next travel to Porto, who won 2-0 at Dinamo Zagreb with Lucho Gonzalez and Steven Defour scoring near the end of the first and second half respectively.
Malaga, playing in the competition for the first time, put their financial worries to one side with a 3-0 home win over Zenit St Petersburg in Group C with two goals from midfielder Isco and one from forward Javier Saviola.
Arsenal and Schalke 04 both took maximum points away from home in Group B.
The London side went behind against debutants Montpellier after only nine minutes when Younes Belhanda chipped an audacious penalty past Arsenal reserve goalkeeper Vito Mannone after Thomas Vermaelen upended Belhanda in the box.
But Arsenal, whose banned French coach Arsene Wenger watched from the stands, stormed back with a well-worked equaliser by Lukas Podolski after 16 minutes before Gervinho scored what was to be the winner with a close-range strike two minutes later.
Schalke won 2-1 at Olympiakos Piraeus with Benedikt Hoewedes and Klaas-Jan Huntelaar, who later missed a penalty, scoring for the German side. Djamel Abdoun had equalised for the hosts.
Borussia Dortmund began with a 1-0 victory over Ajax in Group D with Robert Lewandowski scoring three minutes from time after Mats Hummels had a penalty saved in the 58th minute.
With Real and Manchester City to come, points are at a premium in Group D and Dortmund will be looking to build on their first win when they travel to Manchester on Oct. 3.
AC Milan, seven times European champions, were jeered off by frustrated fans after failing to score at the San Siro for the third successice match, this time against an Anderlecht side back in the Champions League after a six-year absence.