Karim Benzema and Ferland Mendy scored the goals in a must-win game for Zinedine Zidane's men in the Spanish capital.
Madrid now have put the pressure on league leaders Atletico Madrid, who still have two games in hand on their city rivals.
So which players stood out in Madrid?
✔️ GOOD PERFORMANCE
The veteran Brazilian is no longer the world-class left-back he was a few years back but he showed in this performance that he still has something to give.
The 32-year-old provided a fantastic cross for Mendy's goal, whipping the ball in from way out and putting the ball on a plate for the Frenchman.
He had 94 touches of the ball, second only to Mendy, and made a hugely impressive 33 passes in the final third - 15 more than anyone else on the pitch.
❌ BAD PERFORMANCE
Marco Asensio: 6.0
Far from a disastrous performance, but certainly Madrid's weakest cog on the night.
The Spaniard made little impact in an attacking sense, with no dribbles or chances created, no shots and no touches in the box.
He was taken off after 76 minutes.
⭐ STAR MAN
Ferland Mendy: 8.8
The standout player on the pitch - and by a long distance. Mendy doubled Madrid's lead to make the game safe with a clinical finish - sliding in to sweep home Marcelo's cross.
He touched the ball more than anyone else on the pitch - 99 times - but also lost the ball less than anyone who played the full 90 minutes (only four times).
He had an incredible 98% pass completion rate, completed three dribbles and won six of his eight duels.