Karim Benzema gave Los Blancos an early lead but Lionel Messi levelled just over 10 minutes later to become the joint-top scorer of all time in the Clasico.
Sergio Ramos headed in a corner to restore Madrid's lead with nine minutes remaining, and Victor Valdes was sent off on the final whistle for a second yellow card after arguing with referee Miguel Angel Perez Lasa.
Madrid coach Jose Mourinho, presumably with an eye on his side's Champions League last 16 second leg match against Manchester United at Old Trafford in three days time, put out a very different team to the one that beat Barcelona last Tuesday in the semi-final second leg of the Copa del Rey.
Cristiano Ronaldo, Mesut Ozil, Sami Khedira, Gonzalo Higuain and Alvaro Arbeloa all started on the bench, with Kaka, Benzema, Luka Modric, Alvaro Morata and Michael Essien drafted in.
Barcelona put out an almost identical side to the one that lost on Tuesday, with the exception of Cesc Fabregas and the injured Xavi Hernandez, who made way for Thiago Alcantara and David Villa.
Despite Madrid having the weaker side out, they were the first to draw blood after six minutes. Morata picked the ball up on the left wing, beat a placid Dani Alves and delivered a low ball across the box which Benzema tapped in from just a few yards out at the far post to give Madrid the lead.
Barca sought an immediate response but created few chances despite their superior possession. However, they were level on 17 minutes.
Dani Alves delivered a low through-ball into the path of Messi after the Madrid defence and goalkeeper Diego Lopez all hesitated. Unchallenged, the Argentinian drove into the box and shot into the bottom corner to equalise.
It was Messi's 39th goal of the season in La Liga and his 18th in a Clasico, drawing him level with fellow Argentine Alfredo Di Stefano as the player to score the most goals in this fixture.
Morata and then Messi both failed to score from decent openings, both players firing their shots straight into the hands of Valdes and Lopez respectively. The 20-year-old Morata then missed another good chance shortly before half-time, heading a cross by Modric into the side-netting.
The opening stages of the second period were largely uneventful but the double substitution of Ronaldo and Khedira for Kaka and Benzema lifted the Bernabeu crowd, who had previously failed to make a lot of noise in a rare afternoon kick-off and with so many key players missing.
The Portuguese forced a save from Valdes with a stinging free-kick and then a few minutes later shot into the side-netting.
Morata then had the best chance of the second half, receiving a brilliant pass by Pepe with just Valdes to beat, but his shot was pushed out by the goalkeeper - who was wearing the captain's armband in the absence of Carles Puyol and Xavi Hernandez.
Ronaldo then headed a free-kick by Modric just over the bar but Madrid's pressure soon paid off. Modric sent in a corner and Sergio Ramos rose above the Barca defence to head the ball just under the bar and into the back of the net on 81 minutes.
Ronaldo almost doubled the advantage when his powerfully struck free-kick hit the bar, and at the other end Barcelona were denied a penalty when Adriano went over after a challenge by Ramos.
Madrid stood firm to hold on for the three points but there was still drama even after the final whistle had been blown, with Valdes arguing with the referee and receiving a second yellow card, followed by a red.