Barcelona recovered from conceding the quickest El Clasico goal in history to end Real Madrid's 15-match winning run and strike a potentially decisive blow in the race for the Primera Division title.
Despite having lifted the trophy for three years in a row and enjoying both domestic and European dominance over Madrid over recent times, Pep Guardiola's men went into tonight's match as the underdogs, trailing the capital club by three points and having played a game more.
Madrid's form also justified their position as favourites and, when Karim Benzema cashed in on a Victor Valdes error after just 23 seconds, talk of a changing of a guard seemed fair.
But Barcelona showed why they are about to jet off for the FIFA Club World Cup as Europe's best side, hitting back with three goals that silenced the Bernabeau.
The first and third, scored by Alexis Sanchez and Cesc Fabregas, both came 60 seconds after two inexplicably glaring misses from Cristiano Ronaldo, while the second from Xavi came via a huge deflection.
None of that should take the shine off a marvellous result for the Catalan club, though, who will now head to Japan as leaders of the Primera Division courtesy of their better head-to-head record over Madrid, who still have a game in hand.
Madrid will no doubt have pulled clear again by the time they return after Christmas, and their performance was better than the ones they put in against Barca last season.
Coach Jose Mourinho will take little comfort from that, but it had looked as though he would be celebrating when his side got off to a dramatic start.
On a sodden night, Valdes scuffed a clearance straight to Angel Di Maria and, after Sergio Busquets had blocked Mesut Ozil's subsequent shot, Benzema was on the spot to beat the stricken goalkeeper from six yards.
Valdes, aware of how costly his error could be, punched the ground in frustration, while six minutes later at the other end, opposite number Iker Casillas excelled when he pushed a Lionel Messi effort around the post.
Despite Messi's strike, Madrid remained the better side and another fluffed kick from Valdes presented Xabi Alonso with an open goal which he could not find from halfway, before Ronaldo spurned his first golden chance.
With all eyes on how he and Messi would square-up ahead of the upcoming Ballon D'or presentation, he received possession on the edge of the box after a pass from Benzema but, rather than slide Di Maria into space, he shot wide.
Despite his selfishness, it was still a chance Ronaldo would have been expected to have taken, and he was made to pay on 30 minutes as Barca levelled.
A run from Messi took him towards the heart of the Madrid defence and he threaded a pass through to Alexis who did the rest from just inside the area.
Madrid would head to the dressing rooms with even more to grumble about, though, with Messi fortunate to avoid a second yellow card for a foul on Alonso minutes after being booked for dissent.
The start to the second half was not as dramatic as the first, but there was a goal inside eight minutes.
Barca were the scorers, with Xavi putting them ahead on his 600th appearance for the club with a strike that owed a lot to good fortune.
The midfielder took aim from 25 yards and Casillas had it covered until it clipped the heels of Marcelo, leaving the goalkeeper stranded as the ball spun in off the inside of his post.
Having got off to such a perfect start, Madrid were stunned, and Casillas had to be smart to keep out Alexis at his near post.
Messi then fizzed a free-kick wide, before Ronaldo unbelievably planted a free header wide of Valdes' post after a pinpoint Alonso cross.
And, as with his first glorious opportunity, Barca scored within 60 seconds of it, as Fabregas got in at the back post to put a stunning diving header back across Casillas' after a great ball in from Dani Alves.
Madrid looked to set up a thrilling finale, with Benzema and Kaka but going close, but it was not to be and Barca eased home.