Madrid: Barcelona dropped their first points of the season when they were held to a 0-0 draw at Osasuna on Saturday and missed the chance to equal the best ever La Liga start.
Lionel Messi, who had not played since the end of last month due to a thigh strain, came off the bench for the final 25 minutes but not even the World Player of the Year could breach the home defence in Pamplona.
Real Madrid warmed up for Wednesday’s Champions League game against Juventus with victory, when Cristiano Ronaldo’s stoppage-time penalty set the seal on a 2-0 win at home to Malaga, on Saturday.
It was hardly the sparkling performance coach Carlo Ancelotti wanted to dispel doubts about Real’s stuttering start to their domestic campaign but was enough to trim the gap with leaders Barcelona and Atletico Madrid to two points.
Cristiano Ronaldo was comfortably Real’s most dangerous player at the Bernabeu and the Portuguese forward curled a shot against the crossbar in the eighth minute against defensive-minded Malaga.
The visitors did well to keep Real at bay until halftime but fell behind in the first minute of the second half when Angel Di Maria whipped the ball over from the right and it evaded Malaga goalkeeper Willy Caballero's despairing dive before nestling in the back of the net.
Caballero was in inspired form and pulled off a brilliant stop to deny Ronaldo eight minutes from time and made another stunning save to palm away a low shot from substitute Jese two minutes later.
Real’s record signing Gareth Bale, who has been out for several weeks with a thigh strain, came on for Alvaro Morata with some 15 minutes left, suggesting he could play a part against the Italian champions on Wednesday.