Real Madrid s Karim Benzema reacts after missing a chance to score during a Spanish La Liga soccer match between RCD Espanyol and Real Madrid (AP)
It was the third straight match without a win for Madrid, which was coming off a shock home loss to Moldovan club Sheriff in the Champions League and a scoreless home draw against Villarreal in the Spanish league.
Madrid hadn't lost a league match since a 2-1 home defeat against Levante in January. It was unbeaten in 18 straight away games in the competition, one short of its all-time record.
Madrid still tops the league thanks to a better goal difference than defending champion Atletico Madrid, which beat Barcelona 2-0 at home on Saturday. Both Madrid and Atletico have 17 points from eight matches. Real Sociedad can go top if the Basque Country team wins at last-placed Getafe later Sunday.
It was the second consecutive win for promoted Espanyol, which moved to 12th in the standings.
Raul de Tomas opened the scoring for the hosts from close range in the 17th minute and Aleix Vidal added to the lead in the 60th from inside the area after a nice run past the Madrid defense.
Karim Benzema had a goal disallowed in the 67th for offside but found the net again in a breakaway in the 71st after clearing two defenders and sending a low shot into the corner for his league-leading ninth goal.
Eden Hazard had an 84th-minute goal disallowed because Benzema was offside.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)