Ronaldo made it 3-0 in the early stages of the second half, but two Jonathan Viera penalties cut the score to 3-2 with 55 minutes on the clock.
Rayo continued to press in the latter stages, but Madrid held on to claim a vital three points against their rivals.
Here, Sports Mole dissects the 90 minutes of action between the two Spanish rivals.
On target: 6
On target: 5
Was the result fair?
In a word, no. What is happening to Madrid at the moment? Twice in the last few days they have led 3-0 in league games, only to hand their opponents a route back into the match. The first period was very comfortable for the away side, but it was anything but in the second half as Rayo dominated proceedings. It would not have been out of place had the hosts forced a late equaliser after creating a number of chances in the final 10 minutes or so.
What Rayo lack in quality, they more than make up for in pure desire and character. It would have been easy to fold at 3-0 in the early stages of the second period, but they deservedly found a route back into the match with two goals from two penalties. In the end, it was not enough to claim anything from the match, but they will be confident of moving away from trouble this season if they continue to perform in that manner. That said, they were extremely poor defensively in the first period.
Real Madrid's performance
Once more, we saw the best and the worst of Madrid this evening. They were just stunning in the first period as they raced into a two-goal lead, before Ronaldo made it 3-0 in the early stages of the second half. It was also proving to be another impressive night for Gareth Bale, who registered two more assists. However, they just fell apart in the second 45 minutes. Pepe and Marcelo were both guilty of two poor challenges inside the box, allowing Rayo to score twice within a matter of moments. They managed to hold on in the latter stages, but there are still underlying problems in defensive areas.
Sports Mole's man of the match
Jonathan Viera: The on-loan Valencia forward might have been on the losing side this evening, but that took nothing away from his performance. The Spaniard found the back of the net with two penalties in the second period, but that was not the reason why he has gained this award. Instead, it was his attitude under pressure and constant movement in the final third that unnerved Madrid for long spells.
Biggest gaffe of the match
It is hard not to be impressed with Rayo's willingness to attack and commit players forward, but that style of football left them incredibly exposed in the first period. Both Madrid goals in the opening 45 minutes stemmed from mistakes. However, the away side were also poor defensively for long spells in the second half. The match would certainly have given some former defenders nightmares.
For a local derby, there was hardly a challenge of note in an end-to-end first half of football. However, the fixture exploded in the second period. Referee Alfonso Alvarez rightly awarded the home side two penalties in quick succession, but perhaps he should have dismissed Daniel Carvajal after the Madrid right-back felled Roberto Trashorras having already been booked. Overall, the Spaniard officiated the match to a high standard.
Rayo: Rayo will attempt to return to winning ways when they travel to Celta Vigo in the late start next Saturday.
Real Madrid: Carlo Ancelotti's side are in Champions League action away to Juventus on Tuesday, before they welcome Real Sociedad in the league next Saturday.