A Karim Benzema double for Madrid had cancelled out an early strike from Andres Iniesta, but Messi scored his first of the evening after 42 minutes to leave the scores level at 2-2 after 45 minutes of pulsating football.
Los Blancos regained the lead after 55 minutes from a Cristiano Ronaldo penalty, but two Messi penalties in the final 25 minutes saw the current champions leave Madrid with all the points.
Here, Sports Mole dissects the 90 minutes of action between the two Spanish rivals.
On target: 8
On target: 6
Was the result fair?
One thing is for certain - this contest will forever be remembered as one of the greatest Clasicos in history. Los Blancos looked in control at 3-2, but Barcelona made use of their man advantage in the latter stages of proceedings to secure all the points. On the balance of play, Madrid will argue that they deserved at least a point, but Barcelona increased the pressure as the second period advanced and eventually had their reward. When 3-2 behind, the Catalan outfit were all but out of the title race, but now they sit just one point off the top of the division with nine games remaining. For the neutral, it was the perfect outcome.
Madrid might have been two or three goals behind in the early stages had Barcelona taken all their chances this evening, but Carlo Ancelotti's side showed their character to move 2-1 ahead following a strike from Iniesta. Defensively they struggled - with Messi and Iniesta just two players that were afforded far too much space in the final third. It didn't quite happen for Ronaldo despite his strike from the spot, while Gareth Bale was squeezed out of the match in the second period. In truth, the Ramos red changed the course of the match, with Los Blancos forced to retreat into a defensive shape. Ancelotti had hoped that his side would hold on for a point, but Barcelona boss Gerardo Martino made two attacking changes, which paid dividends. That said, both penalties that Madrid conceded were debatable to say the least.
It was a match that Barcelona simply could not afford to lose. Defeat would have left them seven points behind Madrid with just nine games remaining, which would surely have ended their hopes of retaining the title. Benzema's double handed Madrid the advantage in the first period, but Barcelona's domination of the ball eventually proved decisive. The Catalan outfit will argue that Madrid's penalty should not have been awarded, but they had two soft spot kicks of their own. Like Madrid, they struggled defensively, but Messi and Iniesta were both sensational in the final third. Head coach Martino has been criticised for his team selection this season, but the Argentine must be praised for the late changes that he made.
Sports Mole's man of the match
Lionel Messi: The Argentine is supposedly having a bad season, but followed up his hat-trick against Osasuna last week with a treble in the Bernabeu this evening. Not only did his three goals help his side claim all three points and remain in the title race, they also moved the 26-year-old onto 21 Clasico goals, surpassing former Madrid forward Alfredo di Stefano by two strikes in the process. What's more, it moved the former Ballon d'Or winner into second position in the all-time La Liga scoring list behind former Athletic Bilbao forward Telmo Zarra. Overall, it was a stunning evening for Messi, who also set up Iniesta for the first goal of the match.
In truth, it is difficult to pick just one moment, with both defences struggling this evening. Madrid right-back Dani Carvajal had a horror in the early stages when he completely lost Iniesta, who thumped one into the top corner. Barcelona defender Javier Mascherano was also poor for Madrid's first, however, with the Argentine allowing Benzema a free header after losing the flight of the ball. Both teams have such incredible attacking options, but there are still huge question marks over both defences, especially in the big matches.
Well, it would not have been a Clasico without a number of major incidents for referee Alberto Undiano to assess. All three penalties were contentious, with Ronaldo seemingly outside the box when Dani Alves clipped the Madrid forward in the first incident. Barcelona's first saw Ramos fell Neymar inside the area, but the contact was minimal and the resulting red card was perhaps harsh with Pepe on the cover. Barcelona's second was also debatable, with Xabi Alonso making little contact on Iniesta, who had danced into the box. The first 45 minutes passed without major incident and with just three bookings awarded, but Undiano was continually called upon in the second period. Overall, it was a difficult night in difficult circumstances for the Spaniard.
Madrid: Los Blancos will attempt to return to winning ways when they travel to Sevilla in the league on Wednesday.
Barcelona: Next up for Barcelona is a home La Liga clash against Celta Vigo.