Madrid has now won 13 in a row in all competitions after dominating Rayo.
Carlo Ancelotti's men were not quite at their best as they welcomed their Madrid neighbour, but they rarely looked like dropping points in an ultimately comfortable win.
It took the home side less than 10 minutes to break the deadlock as Gareth Bale grabbed his first goal in five Madrid games and, although Sergio Ramos doubled the lead just before the break, former Real youngster Alberto Bueno scored to ensure Rayo was just one behind at halftime.
The two-goal cushion was soon restored, though, as Toni Kroos found the net in style in the 55th minute and a fourth for Madrid was not far behind.
Karim Benzema, although appearing to be offside, knocked in from close range with 31 minutes to go as Cristiano Ronaldo picked up his second assist of the day.
Ronaldo finally grabbed a goal of his own late on, thanks to some questionable goalkeeping, and victory sees Real remain top of the Liga table with 27 points, two more than rival Barcelona.
Ancelotti risked upsetting supporters by not including the in-form Isco in his starting lineup as Bale made his return from a gluteal injury.
The Italian's decision was vindicated just nine minutes in, with Bale getting on the end of Kroos' teasing delivery to give Real an early lead.
The home side struggled to build on that early goal, though, and had Keylor Navas - in for Iker Casillas - to thank for keeping it ahead in the 21st minute as he palmed away Leo Baptistao's stinging drive.
Rayo's resurgence almost fell apart a few moments later, but Mohammed Fatau escaped punishment despite seemingly bringing Ronaldo down when through on goal.
Atletico Madrid-owned Baptistao continued to cause problems at the other end and he went close again 31 minutes in, glancing a header just wide of the bottom-left corner.
But Real eventually doubled the lead in the 40th minute as James Rodriguez's corner was flicked on by Pepe and Ramos - attempting a volley - diverted the ball home with his thigh.
Rayo did hit back with a goal of its own shortly after, though, as Baptistao pounced on Rodriguez's dreadful back pass before squaring to Bueno for an easy finish.
Real reopened the two-goal deficit nine minutes into the second half and did so in impressive fashion.
Ronaldo poked a pass back out to the lurking Kroos 25 yards from goal and the German produced a fine finish which oozed class, delicately placing his first-time effort into the bottom-right corner.
Portugal captain Ronaldo was at the center of things again four minutes later as he flashed the ball into the danger zone and Benzema was on hand to tap in, despite appearing beyond the last defender.
Goalkeeper Cristian Alvarez tipped Bale's fierce volley on to the crossbar, but he gifted Real a fifth moments later, allowing a tame Ronaldo effort to squeeze between his legs to give the scoreline a resounding look.