Cristiano Ronaldo scored late for 10-man Real Madrid to snatch a 2-1 comeback win at Barcelona and revive its slim hopes of challenging for the Spanish league title on Saturday.
Madrid's first win at Camp Nou since 2013 also ended Barcelona's Spanish record unbeaten streak at 39 games across all competitions.
In Zinedine Zidane's first clasico as a manager, Madrid avenged a 4-0 home loss to Barcelona in November by dealing the Catalan club its first defeat since Oct. 3.
After a lackluster first half that followed a moving tribute to Johan Cruyff, Barcelona's Gerard Pique opened the scoring with a header in the 56th.
Karim Benzema equalized six minutes later, and Ronaldo slotted in the winner in the 85th, moments after Madrid's Sergio Ramos received a second booking.
Madrid remained in third place, one point behind Atletico Madrid after its 5-1 win over Real Betis, reducing the deficit with Barcelona to seven points with seven rounds left.
Given the considerable gap and dwindling chances to overtake both frontrunners, Madrid's best shot at silverware still rests in the Champions League, where it will play German side Wolfsburg on Wednesday.
"Step by step, first we have to overtake Atletico Madrid because we are still third, and then we will see what happens," Zidane said.
"What I can say is that winning here is a huge reward for our players because the truth is that they played an enormous match.
"It's very important for our morale to win here, and just before we play a game in the Champions League in Germany."
Despite the loss, Barcelona's quest to repeat its rare treble of Liga, Copa del Rey, and European Cup from last season remains intact.
Barcelona hosts Atletico in the Champions League on Tuesday."Their first goal unnerved us and unfortunately we lost our first game at home" this season, Barcelona coach Luis Enrique said.
"We have to shake it off and recover for the Champions League, which will be a demanding match. We have to think that we are still the leaders with seven rounds left."
Before kickoff, Barcelona played a video of many former players giving thanks to former player and manager Cruyff, who died of lung cancer last week.
The 90,000-plus crowd responded with a long ovation, and formed a huge mosaic with the message "Thanks Johan" in Catalan while they sang the club anthem before a minute of silence.
The same message was also painted on the side of the pitch and worn on the players' shirts.
Another round of applause came at the 14-minute mark, in honor of his number as a player.
Barcelona had the better start after Luis Suarez wasted a cross from Neymar on the break with only goalkeeper Keylor Navas to beat.
At first, Madrid struggled to keep up with the hosts' passing attack, and Ramos and Dani Carvajal were booked by the time Ivan Rakitic drew Navas' first save.
Lionel Messi had a penalty cry that went unheard when Ramos tripped him on the edge of the box. The ungiven penalty seemed to rattle Barcelona, which lost its verve and let Madrid gain composure.
Ronaldo had Madrid's first shot on goal blocked by Claudio Bravo before an ugly stalemate then set in until halftime.
The intensity revved up after the restart, and Navas had to dive and stretch his fingertips to turn Messi's crafty lobbed shot past his post. From the resulting corner, there was nothing Navas could do to keep out Pique's pointblank header, when Pique ran around Neymar and Suarez toward the near post to free him from Pepe.
Madrid quickly leveled against the flow of the match when Marcelo led a disorganized attack that undid Barcelona when Toni Kroos' deflected pass fell to Benzema to sweep in.
While Barcelona battled to regain control, Madrid mounted counterattacks that eventually paid off. Gareth Bale appeared to have scored but his goal was waived off for a foul on Jordi Alba.
Moments later, Ronaldo galloped down and sent a ball off the top of the bar.
Ramos' second yellow card for a clumsy foul on Suarez didn't swing the flow back Barcelona's way, and Madrid got the decisive goal when Bale crossed the ball to Ronaldo at the far post.
He chested the ball down after Dani Alves mistimed his challenge and drilled it in for his league-leading 29th goal of the season.
Elsewhere, Valencia lost at Las Palmas 2-1 in the debut of coach Pako Ayestaran, who replaced the fired Gary Neville.