Karim Benzema, who limped off late on, struck in the 13th minute to ensure there was no repeat of the forgettable 3-0 loss to CSKA Moscow that summarily ended a run of four successive triumphs.
Marco Asensio had chances to put the result beyond doubt before Thibaut Courtois made a crucial double save in stoppage time, Santiago Solari's men returning to winning ways in time for Wednesday's Club World Cup semi-final clash with Kashima Antlers.
They head to the United Arab Emirates two points shy of table-topping Barcelona, who visit Levante on Sunday, and with clean sheets in three straight LaLiga matches for the first time since September 2015.
Madrid began confidently in their bid to move on from the CSKA shock as Lucas Vazquez cut inside from the right and slipped through Benzema for the French forward's first goal in six games.
Chances came and went soon after the opener with Emiliano Velazquez heading marginally wide from a corner, before Stole Dimitrievski foiled Asensio in a one-on-one.
Rayo were fortunate to avoid additional damage before the break, Toni Kroos' left-footed drive cannoning into the post.
Dimitrievski denied Asensio for the second time five minutes after the restart while Sergio Ramos had a header ruled out for a marginal offside call as Madrid's wait for a second stretched beyond the hour.
They were never able to completely put the match to bed against their 19th-placed visitors and, after Benzema hobbled off, it was Courtois' time to shine, the goalkeeper well-placed to block both Alex Alegria's overhead kick and Velazquez's follow-up in a panicked conclusion.
What does it mean? Clear heads for Club World Cup
Madrid's mood needed a lift before the long journey to the UAE and three points on home soil will make the flight a whole lot more comfortable.
They can now concentrate solely on claiming silverware without having to worry about questions that might confront them upon returning to Spain.
Vazquez valuable in victory
On target against Valencia earlier this month, winger Vazquez made another impressive contribution here as he skilfully set up Benzema's opener, threatened to get on the scoresheet himself and was busy throughout.
Asensio out of sorts
Though undoubtedly talented, Asensio's failure to convert either of his two good chances will do nothing to quieten the critics.
The Spain international offered little else in his 70 minutes and, with just one league goal this term, it is perhaps understandable that he is beginning to feature more regularly in transfer rumours.
Key Opta Facts
- Madrid have won their last 17 LaLiga games against Rayo, their best streak against a single team in the competition.
- Benzema has scored six goals in 16 La Liga matches this season, one more than he had last term (five goals in 32 appearances).
- Madrid have scored 24 goals in 16 LaLiga games in 2018-19, their worst tally at this stage of a campaign since 1993-94 (also 24 goals).
Madrid meet Kashima in Abu Dhabi on Wednesday and will hope to have a Club World Cup final to contest prior to their next LaLiga clash, which is away to Villarreal on January 3.
Rayo, meanwhile, have useful time to prepare for Levante's visit next Sunday.