(CNN) -- With Cristiano Ronaldo misfiring in front of goal it was left to Real Madrid defender Pepe to grab the winner as Los Blancos took closer order in the La Liga title race Sunday.
Portugal's Pepe rose unmarked to head home Luka Modric's free kick early in the second half to give his side a 1-0 win at Espanyol.
"He is having a very good season," coach Carlo Ancelotti said of the veteran defender after his team kept a third consecutive clean sheet.
"At first he was hesitant about staying and I told him that he was important for us. It is no coincidence that the team has done better defensively in recent matches. The defenders have improved a lot."
With Barcelona and Atletico Madrid drawing 0-0 Saturday, the victory drew Real to within three points of the leading duo in a three-way title race.
Ronaldo may be hot favorite to be crowned as the world's best player at the Ballon d'Or awards in Zurich Monday, but for once his famed finishing deserted him in this vital match for his side.
Espanyol might have taken an early lead when Cristian Stuani headed wide, but the visitors took command and Ronaldo wasted his first chance after being set up by Karim Benzema.
France forward Benzema headed just wide from a Gareth Bale cross just before halftime and it was Pepe who finally found the net soon after the break.
A second appeared inevitable when Ronaldo broke clear but he was left ruefully shaking his head as Espanyol goalkeeper Kiko Casilla made another superb save.
Another opportunity to get on the score sheet also went begging with the goal at his mercy after Casilla had saved from Benzema.
But in the end Carlo Ancelotti's men easily held out for the victory while Ronaldo will now be hoping he can get the better of Barcelona's Lionel Messi and Franck Ribery of Bayern Munich in the battle to be crowned as top player on the planet.
"He's a born winner and, despite the win, he doesn't feel like he did everything that he could because he didn't score," teammate Sergio Ramos said of the 2008 world player of the year.
"He knows that it was a very important win for the team. If I had my way, I would give it to him. There are a lot of people who think so around the world. The statistics are there to see, and he has broken almost every record out there. Maybe this year he deserves it more than others."
Earlier Sunday, reigning Serie A champions Juventus claimed a club record 11th successive win to maintain an eight-point lead over Roma at the top.
Fernando Llorente scored twice for Juve in the 4-1 win at Cagliari, who had taken the lead through Mauricio Pinilla after 21 minutes.
Claudio Marchisio and Stephan Lichsteiner grabbed the other goals for the visitors. Manchester United manager David Moyes was among the crowd at the match, increasing speculation over his intentions in the latest transfer window.
Roma beat Genoa 4-0 and third placed Napoli, a further two points adrift, won 3-0 at Verona.