Real Madrid are now unbeaten in four games in all competitions, while Inter are unbeaten in six in all competition.
It was a tense affair in the Nou Carrera on Sunday, with Inter struggling to break the deadlock, while Real were able to make the breakthrough on the hour mark, after Ronaldo scored his second of the night.
Inter took the lead on 28 minutes through a penalty awarded to the hosts by referee Marc Bartra, but the result would be a repeat of the derby which saw both sides score twice and see a first-half strike controversially overturned.
After a long spell of possession, Ronaldo headed home from close range, but Real could not get their reward as Real’s own defence failed to hold up against a well-organised Inter side.
After the break, Ronaldo was able to get his side back into the game, as he had a shot blocked by the outstretched hands of goalkeeper Daniele De Rossi.
With only eight minutes to go, a superb finish from Zlatan Ibrahimovic gave Real the lead, with De Rossi putting his arm round Ronaldo’s neck and sending him to the ground.
De Rossi’s subsequent tackle on Ronaldo led to an Inter penalty, and De Rossi had to be stretchered off in the 84th minute, with Ronaldo having already been substituted.
After Ronaldo’s late intervention, De Rossi was substituted for the next game, the 2-0 win at Inter.
Despite scoring a late winner, it was not enough for Real to secure a spot in the Champions League knockout stages.
They are now in fourth place and sit four points above Barcelona, who are fourth and two points ahead of Real.
Real Madrid: Gomes, Crespo, Darmian, Lescott, Matic, Gabbiadini, Khedira, Rodriguez, Ramos, Benzema.
Inter: Mancini, Mertens, Bacca, Kroos, De Bruyne, Benzemann, Ronaldo, Griezmann, Ramos.