Barca had the opportunity to inflict on their rivals a third consecutive loss and raise the pressure on Zinedine Zidane.
Alternatively, the Madrid victory gives them a six-point advantage over the Catalans, having played one more match.
After Federico Valverde and Ansu Fati had traded early strikes in a frantic game that defied those expecting more proof of two heavyweights in decline, Sergio Ramos' penalty and a late Luka Modric goal finished off Barcelona.
Barcelona could feel difficult to do, particularly as after a check by VAR and a hugely exaggerated fall by Madrid's captain after Clement Lenglet tugged his shirt, Ramos' penalty was awarded.
But aside from an impressive spell in the first half, when an inspired Lionel Messi threatened to win the game on his own, for longer spells Madrid was dominant and, when it counted, pulled away.
This was the first Clasico of Ronald Koeman as coach of Barcelona and some of the strain Zidane must have felt from a defeat is now transferred to the Dutchman who, from his first six games in charge, has overseen just three wins.
On Wednesday in the Champions League, Barcelona faces Juventus, without the suspended Gerard Pique.
Now any Barca set-back is seen through the prism of the future of Messi as well. The Argentinean, who failed last summer in his attempt to leave, still has to score this season from open play.