It was win or bust for Madrid with only a victory sufficient to keep the title race alive for 24 hours at least with Barcelona playing Atletico Madrid on Sunday.
Given Jose Mourinho's side came into the match with nine wins and a draw in their last 10 games, anything other than three points for Real seemed unlikely.
However, they were disjointed and off the pace in the first half which was dominated by Espanyol, who were unfortunate to only have a one-goal lead courtesy of Christian Stuani's 23rd-minute strike.
Hector Moreno incorrectly had a goal disallowed as Real appeared to have one eye on next Friday's Copa del Rey final against Atletico Madrid.
However, the introduction of Cristiano Ronaldo was followed moments later by Gonzalo Higuain's 58th-minute equaliser.
Espanyol were reduced to 10 men in injury-time when Victor Sanchez was given his second yellow card after following through on Higuain but Ronaldo sent the resulting free-kick high and wide.
It was a much-improved second-half performance but it was not enough and Barcelona wrested back the title without even playing, seven points ahead of Real who have only two games left.
Mourinho appears to be heading towards the Real exit and it is unlikely Iker Casillas, the subject of perceived criticism by the Portuguese, will mourn his leaving - the club captain again a substitute on Saturday night behind Diego Lopez.
Pepe had called on the manager to show more respect to Casillas and has since found himself out of the squad although he may well return for the Copa del Rey final given Raphael Varane sustained an early injury on Saturday night.
It was a quiet opening with Real probing for openings.
Angel Di Maria had a low curling shot from the right comfortably gathered by Francisco Casilla but there was precious little else before Espanyol went ahead in the 23rd minute from a set-piece as Real went to sleep.
Moreno's corner was flicked on to the far post where Sergio Garcia hooked the ball back and Stuani dug out a left-footed shot from the centre of the area.
Stuani squandered a golden chance to double the lead when he timed his run perfectly to move beyond the defence to find himself one on one with the goalkeeper but Lopez spread himself and blocked the striker's flicked shot.
Espanyol were better all over the pitch and they had an apparently legitimate goal ruled out when Moreno was adjudged to have impeded Xabi Alonso before heading home.
Espanyol resumed the second half in the same manner and Fernandez Nacho had to produce a superb interception with his outstretched leg preventing Mubarak Wakaso's curled cross from reaching Garcia in front of goal.
Ronaldo's entrance was met by jeers from the home crowd but he had been on the field just moments when Real equalised.
Luka Modric curled a free-kick into the area with Higuain rising highest to flick the ball home, just squeezing beyond Casilla.
Lopez smothered at the feet of Moreno with Espanyol fancifully claiming Michael Essien had handled the ball.
The game had become stretched, Wakaso firing a shot in which Lopez held on to before Di Maria fired in for Real.
Ronaldo had a chance in injury-time following Sanchez's red card but he squandered it by some distance as the visitors relinquished their title to Barca.