Match ends, Espanyol 0, Real Madrid 1.
Pepe's second-half header clinched a much-needed win for Real Madrid in their pursuit of Barcelona and Atletico Madrid in the Spanish title race.
Carlo Ancelotti's side moved within three points of the top two, despite a disjointed display against Espanyol.
Ballon d'Or favourite Cristiano Ronaldo suffered a rare off day, fluffing a first-half chance inside the six-yard box and curling wide late on.
But Pepe's towering header from Luka Modric's delivery clinched a vital win.
Despite their profligacy, Los Blancos were rarely threatened by a mid-table Espanyol side and looked comfortable as they recorded their seventh straight win in all competitions.
In fact, they have not been beaten since the 2-1 reverse at Barcelona on 26 October. But the defeat at the Nou Camp, coupled with a 1-0 home loss to neighbours Atletico, has left Real playing catch up in the title race.
The third-placed side knew their trip to Espanyol was one where they could not afford to drop points after seeing Atletico hold leaders Barcelona to a goalless draw on Saturday.
Espanyol started on the front foot as they hassled Real from the kick off and could have taken a third-minute lead when Uruguayan forward Cristian Stuani headed wide.
But Madrid gradually found their rhythm after riding out the early pressure, creating all of the best goalscoring opportunities.
Portugal forward Ronaldo, who is expected to be named the world player of the year at Monday's Ballon d'Or ceremony in Switzerland, failed to cleanly connect with Karim Benzema's square pass before the France striker headed past the Espanyol post in stoppage time.
However, Real needed just 10 minutes of the second half to make their breakthrough. Portugal defender Pepe was left totally unmarked as he nodded into the far corner from Modric's deep free-kick.
World record signing Gareth Bale started his first La Liga game in almost a month after a calf injury, but barely featured before being substituted with a quarter of an hour remaining.
Real continued to press, without being seriously tested at the other end, only for Ronaldo to miss two more clearcut opportunities.
Firstly, the 28-year-old was denied by a superb one-handed save from Espanyol goalkeeper Kiko Casilla, before delicately bending wide with the home goal gaping.
- 16López Rodríguez
- 18Fuentes Hernández
- 25TorjeBooked at 58minsSubstituted forSabrosaat 65'minutes
- 4Sánchez Mata
- 24CórdobaBooked at 83mins
- 22Fernández IglesiasSubstituted forLanzaroteat 65'minutes
- 8StuaniSubstituted forAfonso Fernandesat 84'minutes
- 1Parreño Boix
- 6da Silva Junior
- 10Afonso Fernandes
- 23González Casanova
- 15CarvajalSubstituted forArbeloaat 90+1'minutes
- 19ModricBooked at 13mins
- 22Di María
- 9BenzemaSubstituted forIllarramendiat 90'minutes
- 11BaleSubstituted forRodríguez Ruizat 76'minutes
- 7Cristiano Ronaldo
- 20Rodríguez Ruiz
- José Antonio Teixeira Vitienes
- Shots on Target
Second Half ends, Espanyol 0, Real Madrid 1.
Attempt missed. Javi López (Espanyol) right footed shot from outside the box misses to the right. Assisted by Simão.
Substitution, Real Madrid. Álvaro Arbeloa replaces Daniel Carvajal.
Substitution, Real Madrid. Asier Illarramendi replaces Karim Benzema.
Attempt missed. Cristiano Ronaldo (Real Madrid) right footed shot from the centre of the box is close, but misses to the right.
Attempt saved. Karim Benzema (Real Madrid) left footed shot from the centre of the box is saved in the centre of the goal. Assisted by Ángel Di María.
Attempt missed. Cristiano Ronaldo (Real Madrid) header from the centre of the box is too high. Assisted by Luka Modric with a cross following a set piece situation.
Karim Benzema (Real Madrid) wins a free kick on the right wing.
Foul by Héctor Moreno (Espanyol).
Foul by Xabi Alonso (Real Madrid).
Pizzi (Espanyol) wins a free kick in the attacking half.
Substitution, Espanyol. Pizzi replaces Christian Stuani.
Jhon Córdoba (Espanyol) is shown the yellow card for a bad foul.
Sergio Ramos (Real Madrid) wins a free kick in the defensive half.
Foul by Jhon Córdoba (Espanyol).
Foul by Sergio Ramos (Real Madrid).
Diego Colotto (Espanyol) wins a free kick in the defensive half.
Corner, Real Madrid. Conceded by Kiko Casilla.
Attempt saved. Cristiano Ronaldo (Real Madrid) right footed shot from the centre of the box is saved in the bottom left corner. Assisted by Marcelo.