The defending champions opened the scoring through Uruguayan midfielder Federico Valverde five minutes into the game, but Barca quickly hit back, with Spanish international forward Ansu Fati drawing his side level three minutes later.
The 17-year-old became the youngest goalscorer in El Clasico in the 21st century as a result.
The hosts enjoyed the larger share of possession afterwards and should have taken the lead through Lionel Messi and Philippe Coutinho, but Madrid goalkeeper Thibaut Courtois thwarted the effort of the Argentine, while the Brazilian could only guide his header wide minutes into the second half.
VAR handed the visitors a huge boost, awarding them a controversial penalty after replays showed that Barcelona centre-back Clement Lenglet pulled down his Madrid counterpart Sergio Ramos in the box during a free-kick.
Los Blancos skipper wasn’t going to miss from the spot, and Neto couldn’t save his attempt despite guessing its direction right.
The hosts pulled out all the stops in order to get back into the game, with manager Ronald Koeman throwing in the trio of Antoine Griezmann, Trincao and Ousmane Dembele with eight minutes left on the clock.
Denmark international striker Martin Braithwaite was also brought into the mix three minutes away from time, but none of the quartet could do anything to help Barcelona rescue a draw.
It was a Madrid substitute that got the next and last goal of the game to deal a blow on the hosts.
Croatian midfielder Luka Modric sealed the win for Zinedine Zidane’s men following an error from Neto, and the win now means Madrid have 97 wins in 245 competitive Clasicos, while Barcelona have 96.