Last-place Espanyol was reduced to 10 men in the 45th when Victor Alvarez received a second booking. But it showed more intent after halftime and deservedly went ahead through Joan Verdu's penalty in the 70th after striker Samuele Longo had been fouled in the box.
After Oscar turned in Patrick Ebert's corner to level, Verdu appeared to have snatched the win in added time, only to be ruled offside.
Espanyol coach Mauricio Pochettino will now be under even more pressure after having won just two of a possible 21 points.
"We should have won with 11 and then with 10," said Pochettino. "We have had a sending off in five of our seven games, and it seems the team is now used to playing a man down."
Rayo's victory over Deportivo broke a three-game losing run for the modest Madrid-based club.
Francisco "Piti" Medina finished off a team attack in the 18th minute, and Jose Carlos Fernandez doubled the hosts' lead at Vallecas stadium in the 29th.
Luis "Pizzi" Afonso pulled one back for Deportivo with his spot kick in the 41st after Javi Fuego knocked Alex Bergantinos down in the area.
On Sunday, league leader Barcelona looks for a club-record seventh win in seven games at the start of the season when it hosts Madrid.
Also, it's: Levante vs. Valencia; Mallorca vs. Granada; Athletic Bilbao vs. Osasuna; and Atletico Madrid vs. Malaga.
Celta Vigo beat Sevilla 2-0 on Friday.