Real Madrid stay third on 51 points from 26 games, seven behind second-placed Atletico Madrid and 14 adrift of pacesetters Barcelona.
Real Madrid rested Cristiano Ronaldo and suffered a fifth Liga defeat of the season as Espanyol's Gerard Moreno struck late for a 1-0 win over the Spanish and European champions on Tuesday.
Catalan forward Moreno wasted a number of chances but his last-minute volley took a wicked deflection off defender Raphael Varane to secure Espanyol’s first victory over Real in 11 years.
Real stay third on 51 points from 26 games, seven behind second-placed Atletico Madrid, who host Leganes on Wednesday, and 14 adrift of pacesetters Barcelona who play on Thursday.
Real coach Zinedine Zidane rested Ronaldo ahead of next week’s visit to Paris St-Germain in the Champions League last 16, which his side lead 3-1 from the first leg, and selected Gareth Bale at centre forward in a much-changed team.
However, despite a promising start, an insipid Madrid were second-best all night at Cornella not that Zidane thought so.
“We really didn’t deserve to ship that goal,” said the Frenchman. “We played really well in the first half but couldn’t score. The second-half wasn’t good but nevertheless we didn’t deserve to concede in the final minute.
“Espanyol had few chances and we deserved more. That’s football and we now have to look forward.”
Bale, having struggled to get back into the side following injury, saw a header parried by Espanyol's former Real keeper Diego Lopez, who then scrambled away a deflected Marco Asensio cross, but that was as good as it got for the visitors.
Espanyol should have led only for Moreno to spurn a gilt-edged chance after pouncing on a wayward Varane clearance. The forward’s misery was compounded when he saw a successful effort incorrectly ruled out by the linesman’s flag before halftime.
After the break Espanyol defender Oscar Duarte clipped the bar before Real keeper Keylor Navas acrobatically denied Moreno.
It appeared the forward was going to endure a torrid night when his left-foot effort curled past the far post with a minute left but Moreno was not to be denied at the death.
His goal securing a deserved three points that took Espanyol up to 13th with 31 points after their first win in eight games.
“We need to go game-by-game,” Moreno said. “This victory will help us and calm things down a bit. We should be doing this more regularly and it’ll give us the confidence that we needed. Hopefully it will push us forwards to better things."