Atlético Madrid and Barcelona remain locked together on 50 points at the top of La Liga after a 0-0 draw at the Vicente Calderon on Saturday.
But Portuguese defender Pepe got Real Madrid the win they needed to close in on La Liga's leaders on Sunday.
The controversial player, criticized for his somewhat aggressive play, headed home a Luka Modric's free-kick 10 minutes after half-time to seal Real's win.
Cristiano Ronaldo should then have added to his side's lead on a number of occasions.
But despite their star man having an off night in front of goal, Madrid comfortably held on for the three points as Espanyol created nothing of note after falling behind.
"I am satisfied with how we played because we had a good balance, we played good football and kept trying to score until the last minute," said Real boss Carlo Ancelotti.
The Italian also hailed the importance of his side taking advantage of Atletico and Barca's 0-0 draw on Saturday to bring themselves right back into the title race.
"It was an important moment. We haven't had many chances to cut the gap because the top two teams have been doing very well so I am very satisfied.
"It is not normal to need 100 points to win the league, but this is the Spanish league and there are three very strong teams.
"To win this league you need 100 points and that is what we need to get. It will not be easy but we have the hunger and will to do it."
Espanyol had started on the front foot and should have been in front after just three minutes when Cristian Stuani skewed his header wide when unmarked just six yards out.
Thereafter, though, Madrid had the better of the chances in the first-half without ever completely dominating the game.
Ronaldo uncharacteristically fluffed his lines after Karim Benzema's fine solo run down the left had freed the Portuguese inside the area.
Espanyol keeper Kiko Casilla also had to beat away Angel di Maria's long-range drive and a free-kick from Ronaldo.
However, the visitors best chances of the first 45 minutes came just before the break when Modric led a counter-attack, but after feeding Di Maria the Argentine failed to pick out one of four available teammates. The ball eventually fell to Gareth Bale and his cross was headed just wide by Benzema.
Madrid did make the breakthrough 10 minutes into the second-half as Modric's free-kick towards the back post was powerfully headed low into the far corner by the unmarked Pepe.
For Ronaldo, who is expected to pick up his second Ballon d'Or in Zurich on Monday, frustration continued to build as he also dragged an effort wide after being released by Di Maria.
Bale was starting a league game for the first time in nearly a month and his looked short of match sharpness as he contributed little before being replaced by Jese Rodriguez 15 minutes from time.
Casilla produced a stunning one hand save to prevent Ronaldo once more as he bore down on goal and Ronaldo then somehow fired wide with Casilla prone on the floor having parried Benzema's initial effort.