Carlo Ancelotti's reigning champions welcomed Hansi Flick's challengers to the Bernabeu attempting to emulate their rivals' unrivalled 43-game unbeaten run in La Liga, having gone 42 without defeat in the Spanish top flight before Saturday.
Victory for Los Blancos would have also taken them level with La Blaugrana at the summit of the La Liga standings, but the Champions League holders lost their unbeaten streak in astonishing circumstances on their own patch.
As Kylian Mbappe had a strike disallowed for offside and failed to stay level with the last defender throughout the evening, his senior - Robert Lewandowski - taught him an attacking lesson with a slick opener and brilliant header to double his tally in the second period.
The Pole's brace preceded a debut El Clasico goal from Yamal, who received Raphinha's pass on the right-hand side of the box and lashed a wonderful finish into the roof of the net over Andriy Lunin's reach.
Yamal becomes youngest scorer in El Clasico history
In doing so, the 2007-born attacker became the youngest-ever player to score a goal in El Clasico at just 17 years and 106 days, breaking the previous record that had stood for a staggering 77 years.
Before Yamal made the net bulge against Real Madrid, the title of El Clasico's youngest scorer belonged to Alfonso Navarro, who bagged a brace for Barcelona at 17 years and 365 days old all the way back in 1947.
The Spain international now has a terrific 13 goal contributions to show from 14 games this season - six of his own and seven assists - and he has been directly involved in a goal in nine of Barca's 11 La Liga matches so far this term.
Following Yamal's record-breaking strike, the equally impressive Raphinha capped off an El Clasico crushing for Barcelona, who have now opened up a six-point lead over Real Madrid in the La Liga table.
Yamal issued a rallying cry to his Barca teammates in the wake of Saturday's success, telling Barca's media channels: "I want to say: visca Barca! Let's go and win La Liga, we go for it now."
What other records has 17-year-old Yamal broken?
Superlatives arguably do not do the generational talent that is Yamal justice anymore, and the youngest scorer in El Clasico history has been breaking records left, right and centre ever since he burst onto the scene.
First trusted in a senior match by Xavi, Yamal became Barca's youngest player in over 100 years when he made his debut in the closing stages of the 2022-23 season, which preceded a breakout 2023-24 year.
Last term, Yamal achieved the following: youngest goalscorer in the history of La Liga, the Copa del Rey and Supercopa de Espana, the youngest player to set up a goal for Barcelona and the youngest man to net a brace in La Liga.
Internationally, the teenager is the youngest-ever man to start for Spain, score for Spain and win the European Championships, feats that may very well earn him the Kopa Trophy at Monday's Ballon d'Or ceremony.
Yamal would become the third Barcelona player in four years to win the award should he fend off his nine fellow nominees, with Pedri taking it home in 2021 and Gavi being bestowed with the honour in 2022.