Real Madrid emerged the victors in an entertaining Clasico on Saturday evening.
Los Blancos welcomed Barcelona to the Alfredo Di Stefano stadium with so much riding on the game.
The two sides were separated by just two points going into the clash. A win for either side would see them go to the top of the La Liga table.
And it was Real who started the stronger of the two teams.
Zinedine Zidane's side took the lead in the 13th minute through Karim Benzema.
Lucas Vazquez sent in a cross from the right-hand side and Benzema produced a clever flick to give his side the advantage.
Real doubled their lead 15 minutes later.
Toni Kroos' free-kick deflected off the wall and Jordi Alba, who positioned himself on the goal line, could not prevent the ball from hitting the back of the net.
Barcelona were poor in the opening 45 minutes but they struck the post late on.
Lionel Messi appeared to go for goal directly from a corner and his effort deceived Thibaut Courtois, who watched the ball cannon off the post and away to safety.
Real were well worth their two-goal lead going into half-time.
The conditions would deteriorate after the break as the heavens opened and it started pouring with rain.
And Barcelona adapted well to the wet conditions as they enjoyed a much-improved second half.
They managed to halve the deficit through Oscar Mingueza's finish on the hour-mark.
Jordi Alba swung the ball into the box and the 21-year-old's effort found its way past Courtois.
There were chances aplenty in the remaining 30 minutes as both sides created chances.
Barcelona thought they should have had a penalty late on when Martin Braithwaite went down inside the box.
But the referee waved away their protests, much to the annoyance of Jordi Alba, who was booked for his actions.
Casemiro was sent off in the 90th minute after felling Antoine Griezmann just outside the box.
Barcelona struck the post with virtually the last kick of the game through Ilaix Moriba but Real held on to all three points.
They have reached the summit of La Liga, one point clear of Barcelona in third.