Casemiro scored the only goal as he latched onto Karim Benzema's brilliant no-look backheel through the legs of defender Bernardo Espinosa before firing home.
The Brazilian had earlier gone close to the opener when his shot from his own half was saved by Diego Lopez.
Espanyol had several chances with Thibaut Courtois making five saves.
Sporting director Francisco Rufete took over as manager on Saturday after replacing Abelardo Fernandez - the third Espanyol boss to be sacked this season.
They put up a good fight, with Wu Lei among the players to go close, but fell just short.
Real Madrid are now only six wins - or five wins and a draw - from a second La Liga title since 2012.
City rivals Atletico can do them a favour when they visit Barca on Thursday.
By BBC; European Football Section