A late Rodrygo strike for Real Madrid was enough to see off the stern challenge of Inter and clinch a 3-2 home win which blows their Champions League group wide open.
Madrid had raced into a two nil advantage, with Karim Benzema taking advantage of a poor Achraf Hakimi backpass to slot into the empty net.
And captain Sergio Ramos made it two minutes later, powering home a superb header to give his side an excellent advantage.
But a sublime team goal involving a backheel flick from Nicola Barella allowed Lautaro Martinez to slot home and bring the Nerazzurri back into the game.
And when Ivan Perisic bundled home the equaliser in the second half it looked as if Inter were in the ascendency and could go on to win it.
But two of Zinedine Zidane's substitutes, Vinicius Jr and Rodrygo, combined to allow the latter to lash his shot into the roof of the net and secure an important three points.
Madrid had already lost to Shakhtar and drew away with Borussia Monchengladbach in the group, and so the three points were vital to their chances of qualification.