Sergio Ramos powered in a dramatic stoppage-time winner as La Liga leaders Real Madrid came from behind to beat Deportivo La Coruna 3-2 at the Santiago Bernabeu and extend their unbeaten run to a club-record 35 matches.
Alvaro Morata, one of some eight changes by Real manager Zinedine Zidane, had fired the hosts into the lead after 50 minutes with a fine finish.
However, a quickfire double from former Real Madrid Castilla forward Joselu in the space of two minutes then turned the match around.
Substitute Diaz Mariano equalised with six minutes left and Ramos sent the Bernabeu into raptures when he powered in a header from a corner as Zidane's men eclipsed the club landmark set by Leo Beenhakker's side from the 1988/89 season.
Earlier on Saturday, Barcelona had returned to winning ways in LaLiga with a 3-0 win at bottom club Osasuna.
The failure to cut Real Madrid's six-point lead in El Clasico last weekend made a victory essential at El Sadar, where a brace from Lionel Messi helped put an end to three straight LaLiga draws.
Barcelona, who beat Borussia Monchengladbach 4-0 in their midweek Champions League tie, came close to going behind early in the second half when Sergio Leon's clever chip struck the crossbar.
However, the visitors took the lead just before the hour mark when Luis Suarez tapped in Jordi Alba's first-time ball across the area.
Messi then took the game away from Osasuna by adding a second after 72 minutes, when he clipped Alba's cutback in at the near post before making it 3-0 in stoppage time with a fine individual effort.
The defeat was Osasuna's fifth in succession in La Liga, leaving them on just seven points and looking set for a swift return to the second tier.
Real Sociedad climbed to fourth with a 3-2 victory over Valencia who finished with 10 men at Estadio Anoeta.
Willian Jose scored two first-half headers, before Dani Parejo reduced the deficit from the penalty spot in the 36th minute to give Los Che hope.
Carlos Vela saw his penalty saved on the hour mark, before Valencia right-back Joao Cancelo was sent off with nine minutes left for a second caution.
Juanmi added a third for Sociedad in stoppage time, although Zakaria Bakkali reduced the arrears with almost the final kick of the match.
The defeat means Cesare Prandelli's side have now gone seven league matches without a win, and remain in deep trouble just outside the relegation zone.
Leganes came from behind to earn a 1-1 draw with Las Palmas at the Estadio de Gran Canaria.
Marko Livaja put the home side ahead from close range on 21 minutes.
However, Leganes recovered and earned a share of the points when Miguel Guerrero converted a second-half penalty to keep some daylight between them and the scrap for survival.