Madrid maintain the edge as they have a game in hand but needed a winner four minutes from time from Marcelo to see off Valencia 2-1.
Luis Suarez scored twice as FC Barcelona gratefully pounced on a series of Espanyol errors to win the Catalan derby 3-0 and move top of the table thanks to their better head-to-head record over Real Madrid.
“The only thing we can do is win our games and keep putting a little pressure on,” Suarez said. “They have a difficult and tiring schedule and we’ll see what happens come the end of the season.”
Jose Manuel Jurado was the Espanyol villain as he dragged well wide with easily the clearest chance of the first half.
The former Watford midfielder’s misplaced pass then teed up Suarez to end a five-game goal drought with a neat finish five minutes into the second period.
Lionel Messi didn’t add to his 49 goals this season but still played a vital role as he teed up Ivan Rakitic for Barca’s second 14 minutes from time.
And Suarez benefited from another defensive howler, this time from Aaron Martin, to slot home his second three minutes from the end.
At the Bernabeu, Marcelo’s late intervention saved Cristiano Ronaldo’s blushes despite the Portuguese setting another goalscoring record as he failed to beat Valencia goalkeeper Diego Alves from the penalty spot for the third time in four attempts.
Madrid boss Zinedine Zidane recalled eight of the side that started last weekend’s 3-2 Clasico defeat to Barcelona and had been rested for a 6-2 thrashing of Deportivo la Coruna in midweek.
However, the habitual first team nearly got off to the worst possible start when Santi Mina hit the post inside the first minute.
Ronaldo eclipses Greaves
But Ronaldo eased Real nerves as he planted Dani Carvajal’s cross into the far corner in characteristic fashion on 27 minutes.
That goal took Ronaldo’s tally in league football to 367 goals to surpass legendary English striker Jimmy Greaves across Europe’s top divisions.
However, even the four-time world player of the year struggles to beat Alves from the spot as the Brazilian made his sixth penalty save of the season when he dived low to his left to deny Ronaldo early in the second half.
That miss looked costly when Dani Parejo’s brilliant free-kick set up a grandstand finish eight minute from time.
Yet, for the seventh time in La Liga this season, Madrid struck as Marcelo cut inside onto his weaker right foot to fire across and past the helpless Alves to joyous scenes of relief at the Santiago Bernabeu.
“It is true that we were in a comfort zone for 30 minutes, the fans were the same,” said Zidane.
“After Valencia scored they started to push the players on once more and it was a completely different match.
“We know we are going to have to suffer until the end of the season.”
Next up for Real is a Champions League semi-final first leg on Tuesday at home to a Atletico Madrid side full of confidence after they thumped Las Palmas 5-0 to move three points clear of Sevilla in third.
Atletico struck three times in the first 18 minutes in the Canary Islands as Kevin Gameiro netted a double either side of Saul Niguez’s header.
Kevin-Prince Boateng was then sent off for Las Palmas and Atletico made their man advantage count with further goals from Thomas Partey and Fernando Torres.
Tony Adams’s Granada were relegated after they lost for the fourth straight game since the Englishman took charge, going down 2-1 at Real Sociedad.
Meanwhile, Levante sealed promotion back to La Liga with a 1-0 win over Real Oviedo.