Karim Benzema prepared for picking up the Ballon d’Or award with a goal as Real Madrid turned up pressure on Barcelona manager Xavi Hernandez with victory in El Clasico.
First-half goals from Benzema and Federico Valverde put Real in control at the Bernabeu.
Substitute Ferran Torres pulled a goal back for Barca late on to set up a nervy finish but Rodrygo sealed victory for Real from the penalty spot in stoppage time.
The win moves Real three points clear of their rivals at the top of La Liga.
It was a damaging defeat at the end of a tough week for Barcelona, who are also facing an early exit in the Champions League after their 3-3 draw with Inter Milan.
Benzema, who is favourite to be named winner of the Ballon d’Or award at a ceremony in Paris on Monday, came out on top in his battle of the No9s with Robert Lewandowski, who had a frustrating afternoon.