Real Madrid boss Carlo Ancelotti said he was proud of his players after they came from behind to beat Barcelona.
Neymar put the visitors ahead before goals from Cristiano Ronaldo, Pepe and Karim Benzema gave the hosts victory.
It was Barcelona's first La Liga defeat in nine matches this season and moved Real up to second place in the table.
"I'm proud of these players because their professionalism and seriousness is unique," said former Chelsea manager Ancelotti.
"We didn't lose our heads after going behind. We stuck to our ideas and everything came off well.
"We wanted to attack, with possession, using the wings. In the second half, we won the game because we wanted to win it.
"This is a very important win for us because Barcelona were very strong, and we achieved our goal of cutting the points gap, so we are very satisfied."
Barcelona had only dropped two La Liga points this season from their previous eight matches and not conceded a league goal before this defeat.
But Real are now only one point behind their rivals in the table after their sixth successive domestic victory.