Real and Spain defender Ramos was shown a red card in the 18th minute after collecting two soft bookings in the space of 30 seconds.
The first came after he brushed past Roberto Trashorras with the Rayo player theatrically going to ground and the second for a handball after Jose Manuel Casado fired a cross against his arm from close range.
By the time he departed, Madrid were already 2-0 up. Alvaro Morata, on his first league start, tapped home Mesut Ozil's right-wing cross in the third minute and Ramos himself grabbed the second with a powerful header from Ozil's inswinging free-kick.
Rayo had plenty of the ball in the second half but could not find a way past Madrid goalkeeper Diego Lopez.
Madrid remain third, four points behind city rivals Atletico and 16 adrift of runaway leaders Barcelona.
Atletico were impressive 3-0 winners at Real Valladolid earlier in Sunday evening.
Radamel Falcao's early opener was added to by Diego Costa, back in the side following a suspension, with Cristian Rodriguez adding a late third as Diego Simeone's men picked up their first away win since November 18.
Ten-man Valencia claimed an unlikely 2-0 win to add to struggling Real Mallorca's relegation worries.
Things looked to be going wrong for the hosts when a slow start was compounded by having midfielder Tino Costa sent off in the 28th minute.
But Mallorca could not take advantage and went behind in the 59th minute when Ricardo Costa headed Valencia in front.
Roberto Soldado doubled the lead in the 81st minute to boost his side's top-four hopes and leave Mallorca rooted in the bottom three.
Real Sociedad missed a chance to gain ground in their bid to qualify for the Europa League by failing to beat Levante at home.
Both goals came from penalties in the first half, scored by Carlos Vela for the hosts and Michel for the visitors, who played most of the second half with 10 men after left-back Nikos Karabelas was sent off for picking up two bookings.
Espanyol's remarkable revival under coach Javier Aguirre continued as a solitary Sergio Garcia goal earned the Catalan club a third consecutive league win.
Real Betis, though, are on the slide having failed to win in five attempts and Pepe Mel watched his charges struggle to create a handful of half-chances at the El Prat.
The hosts, who were perhaps unlucky not to win by a larger margin, climb to 12th in the table ahead of a daunting trip to Atletico.
Lionel Messi struck his 300th and 301st goals for Barcelona as the La Liga leaders overturned a half-time deficit to win 2-1 at plucky Granada.
Barca dominated possession for the first 25 minutes, but were stunned when Odion Ighalo put the hosts ahead at the Estadio Nuevo Los Carmenes.
Messi tapped in a deserved equaliser five minutes into the second half, though, and then curled in a free-kick 17 minutes from time to complete the turnaround and move Barca 15 points clear at the summit.
A first half goal by Javier Saviola earned Malaga a 1-0 victory over Athletic Bilbao to ensure they will remain fourth in the table by the end of the weekend.
Lucas Piazon, on loan from Chelsea until the end of the season, made his first start for Malaga and marked the occasion by providing the assist for the only goal of the game.
The 19-year-old used skill and strength to advance into the Athletic area and pulled a pass back from the by-line into the path of Saviola near the penalty spot and the striker shot high into the net after 18 minutes.
Celta Vigo remained in the relegation zone after suffering their third defeat in a row away with a 3-1 loss to Getafe.
All the goals came in a frantic first half. Adrian Colunga opened the scoring for the hosts after 10 minutes but Augusto Fernandez equalised just 10 minutes later, before Diego Castro and then Federico Fernandez added goals of their own before the break.
An early goal by Kike Sola saw Osasuna earn themselves some much-needed breathing space from the relegation zone with a 10 win over rivals Real Zaragoza.
Sunday's La Liga Results
Saturday's La Liga Results
Friday's La Liga Result