Messi flashed an effort narrowly wide of the post moments later before the Argentine was hustled off the ball in the area following an error from Sergio Ramos.
Despite the dominance of the visitors in possession, Madrid almost snatched a second goal in the final minutes of the half when Morata headed Kaka's cross wide.
Barcelona continued to dominate proceedings in the opening minutes of the second half, but failed to test a resolute Madrid defence led by Varane.
Jose Maria Callejon had a good chance for Los Blancos on the hour mark but his effort went wide. Jose Mourinho's side had another opportunity to surge ahead on 76 minutes but Victor Valdes denied Morata with a good save.
Ramos wrapped up the points for Madrid three minutes later when he headed home Ronaldo's delivery from close range.
The match could have ended 3-1 in favour of the home side had Ronaldo's free kick on 87 minutes not come off the Barca crossbar.
Things turned ugly following the final whistle as Valdes was sent off for arguing with the referee.