The two sides produced a thrilling first half in which Fede Valverde and Ansu Fati exchanged goals in the first 10 minutes, before Barcelona seemingly took control early in the second stanza. However, a key penalty call via VAR earned Real Madrid a penalty, which Ramos duly converted, and a late Luka Modric strike polished things off for Los Blancos.
The win for Real Madrid halts a two-match losing streak, while it marks a second straight LaLiga loss for the Catalans.
There was a strong infusion of youth in the starting XI of Barcelona boss Ronald Koeman, with 17-year-olds Pedri and Ansu Fati getting the nod on the wings, as did 19-year-old right-back Sergino Dest, who became the first ever United States player to start and play in a Clasico.
As for the visitors from the capital and maligned head coach Zinedine Zidane, Marco Asensio was a notable inclusion in attack for Los Blancos, while it was surprising to see veteran midfielder Modric relegated to the bench. Ramos also won his race to fitness and was slotted in at his customary centre-back position.
Zidane’s men were quick out of the gates and drew first blood inside the first five minutes when a perfectly weighted pass from Karim Benzema found a wide-open Valverde, who sent a rocket into net for a 0-1 Real Madrid lead.
But the defensive frailties showed by Real Madrid in their previous outings were exposed in short order and a ball over the top from Messi found the streaking Jordi Alba on the left wing. The veteran left-back, who was making a return from injury, then hit a perfect square ball for Ansu Fati to turn into net to even things up 1-1.
The action was end-to-end and seconds after Real Marid goalkeeper Thibaut Courtois denied Messi at the near post, Barcelona shot-stopper Neto had to come up big with a save from a Benzema shot after a superb cross from Toni Kroos.
Shortly before half time, Zidane was forced into his first change with the hobbling Nacho having to yield his spot to Lucas Vazquez.
Barcelona had the stronger start of the two in the second half and a Ansu Fati cross floated to Philippe Coutinho could have been headed in, but the Brazilian missed wide.
Right when Barcelona were displaying their best football, controversy erupted and a penalty was awarded to Real Madrid after VAR ruled that Clement Lenglet had pulled on Ramos’ shirt in the area. The captain stepped up and like he has so many times, coolly converted the spot-kick to hand Real Madrid a 1-2 lead.
An injury to a woozy Fede Valverde provoked the second change for Real Madrid, as Modric came on for the young Uruguayan.
With less than a quarter-hour to play, Koeman finally made his first changes, with Antoine Griezmann, Francisco Trincao and Ousmane Dembele came on for Ansu Fati, Pedri and Busquets, while Zidane swapped off Asensio for Rodrygo Goes.
Barcelona’s frustrations began to grow, while Real Madrid looked very comfortable holding the late lead. Los Blancos had a trio of chances to put the nail in the coffin, the first two coming off the boot of Kroos, followed shortly by a clear-cut chance for Ramos, only to see Neto rise to the challenge and make a pair of spectacular saves.
Martin Braithwaite was the next roll of the dice from Koeman in replacing Alba, but it was all for naught when Neto spilled the ball with Vinicius charging and Modric cleaned things up by depositing the ball into the net to complete the 1-3 scoreline.