Sergio Ramos headed in a corner to restore Madrid's lead with nine minutes remaining, and Victor Valdes was sent off after the final whistle for a second yellow card after arguing with referee Miguel Angel Perez Lasa.
Madrid closed the gap in the table to 13 points behind Barcelona. Barcelona assistant coach Jordi Roura was happy with his team's performance, despite the defeat.
"We came here to try and increase our advantage, and we have to be happy with the team's attitude," Roura said. "We stood up and were counted and had chances to win at a very difficult stadium."
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 second leg of the Copa del Rey semifinal.
"You need all your players to deliver in a big game like this, including the ones who play less often," said Real assistant coach Aitor Karanka. "Of all the performances of the team, I was particularly impressed with those players. The team have shown that, whoever is playing, they deserve to be trusted."
Despite Madrid having the weaker side, it was 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 controlling possession. However, Messi equalized after 17 minutes.
Dani Alves delivered a low through-ball into the path of Messi after the Madrid defense and goalkeeper Diego Lopez all hesitated. Unchallenged, the Argentinian drove into the box and shot into the bottom corner to level the score.
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, with 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 halftime, 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 kickoff, and with so many key players missing.
Ronaldo 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.
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 defense 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 was denied a penalty when Adriano went over after a challenge by Ramos.
Roura did not complain outright about the penalty which Adriano was denied in the final minutes, but he implied he was not happy with the decision.
"I don't have anything more to say about the refereeing," Roura said. "I spoke during the week and to me it is perfectly clear if you look at the replays."
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.
There was not as much to talk about in the game between Deportivo La Coruna and Rayo Vallecano, however, with the match ending 0-0. Depor did bring to an end its six-match losing streak but still remains deep in trouble at the foot of the table after being held at home.
Athletic Bilbao eased their drop fears with a much-needed victory over local rivals Osasuna at the Reyno de Navarra stadium to move six points clear of the relegation zone. A volleyed goal by Markel Susaeta midway through the second half was enough to give Marcelo Bielsa's side the three points, but the Navarrans were superior for large periods of the match.
In the day's late game, the derby between Valencia and Levante, an 89th-minute equalizer from Jose Barkero stopped Los Che moving above Malaga into fourth place. His goal came after Jonas and Roberto Soldado had turned around Vicente Iborra's opener for Levante, which remained in mid-table.
Information from Press Association was used in this report.