Benzema scored the 13th-minute opener and Ronaldo added a penalty in the 70th after Jordi Amat had handled the ball in the box to keep Madrid eight points behind Spanish league leader Barcelona after five rounds.
"Rayo has a great team with quality players and they made it very tough for us," said Madrid defender Pepe. "We have to keep fighting. This has just begun and we have to take each game seriously, so we can cut into (Barcelona's) lead little by little."
In a match delayed by a day due to the stadium lights at Vallecas stadium being cut in an act of sabotage, Madrid showed little of the verve from its memorable victory over Manchester City in the Champions League last week.
Instead, Jose Mourinho's squad returned to its uninspired domestic form against one of the league's more modest teams, needing a flash of individual talent and a defensive error to take the critical three points.
While far from bubbling with praise for his players, Mourinho has obviously seen improvement since the previous round when he said he "didn't have a team" and questioned his players' commitment after losing 1-0 at Sevilla.
"The team was a team (tonight), but we could have played better," said Mourinho. "During long stretches of last season we were always on target and routed our rivals, but right now we are not playing well. We have no confidence."
Also, Sevilla won 2-0 at Deportivo La Coruna thanks to second-half goals by Alvaro Negredo and Ivan Rakitic, keeping the Andalusian side undefeated and four points behind Barcelona.
The Spanish capital derby was held after electricians repaired the various cables that were damaged at Rayo's stadium by unidentified persons on Sunday, in what club president Raul Martin Presa called "football terrorism."
Sergio Ramos returned to the starting team after Mourinho had left him on the bench for Madrid's win over City, apparently singling out the Spain defender for his team's loss in the previous round.
"I don't know if it was a punishment," said Ramos, adding that he thought his absence from the City match was due to "tactical reasons."
Angel Di Maria teed up Madrid's opener when the Argentina international was given time on the left flank to pick out Benzema at the far post and thread a pass between three defenders for his striker to tap into the net. It was Benzema's first goal in the league this season.
Twice in the first four rounds, Madrid had looked set to cruise to an easy win after going ahead early, only to let victory slip away. And Mourinho's team appeared close to repeating the pattern on Monday after slowing up following a strong start.
Rayo almost struck back from a set piece in the 33rd. Striker Andrija Delibasic drew a reflex save from goalkeeper Iker Casillas with his header, and Xabi Alonso was well positioned on the goal line to block Jose Casado's volleyed rebound.
Madrid defender Alvaro Arbeloa came near to gifting Rayo an equalizer in the 52nd when he failed to spot Leonardo Carrilho before passing back to Casillas, but the forward squandered the chance.
Madrid was eventually able to relax when Rayo defender Amat deflected Ronaldo's cross with his arm inside the area, and the Portugal forward slotted home the spot kick to decide the contest.
"We were a little unsettled at the beginning, but we kept the game more or less under control," said Rayo coach Paco Jemez. "And just when we were playing our best they got their second goal. The game was closer to ending in a draw than 2-0 at that moment."
Ronaldo, who has yet to explain why he is "sad" at Madrid, scuffed a clear shot at an open net three minutes later to hit the crossbar.
Over the weekend, it was: Zaragoza 3, Osasuna 1; Celta Vigo 2, Getafe 1; Real Betis 1, Espanyol 0; Barcelona 2 Granada 0; Mallorca 2, Valencia 0; Levante 2, Real Sociedad 1; Atletico Madrid 2, Valladolid 1; and Athletic Bilbao 0, Malaga 0.