Gareth Bale stepped from the substitutes’ bench to net his 100th Real Madrid goal and seal a derby success for Santiago Solari’s men against rivals Atletico.
The Welshman was left on the bench once more, with Solari preferring youngster Vinicius Jr in attack with Karim Benzema and Lucas Vazquez.
But after replacing the Brazilian teenager in the second period, he landed the knockout blow on Atleti, driving past Jan Oblak after being found by Luka Modric.
That came after a thrilling first period, which saw the away side take a 2-1 lead into the break.
Casemiro opened the scoring after 13 minutes with an outstanding acrobatic effort from close range, before Antoine Griezmann levelled for the hosts, coolly slotting through the legs of Thibaut Courtois.
Courtois was pelted with toy rats by home fans on his return to Atletico but he was all smiles three minutes before half-time as Sergio Ramos’ put the visitors back in front.
Vinicius Jr was brought down in the penalty area by a reckless Jose Gimenez challenge, and the Spain defender fires home from 12 yards.
Bale extended the advantage in the 74th minute, before Thomas Partey was shown a second yellow card 10 minutes from time.
Los Blancos’ victory moves them into second in La Liga, ahead of Atleti, but five points behind leaders Barcelona.