The visitors struck first, taking the lead after just seven minutes when Messi slipped a pass through to Andres Iniesta, who took a touch before blasting his effort into the top corner.
Barca were the next to come close as Xavi fed the ball through to Messi, but for once the Argentine was not on target, slipping his shot just past the post.
Messi then turned provider to set up a chance for Neymar, but the Brazilian failed to take it and was immediately punished as Madrid went up the other end and equalised through a Benzema header.
Benzema doubled his personal tally just four minutes later, firing an effort into the top corner having once again been found by Di Maria.
The same duo combined again in the 26th minute as Benzema came within inches of a six-minute hat-trick only to see his header cleared off the line by Gerard Pique.
The visitors were level before half time as Messi got his first of the evening, dancing into the box before drilling a low shot past Diego Lopez.
Benzema almost capped off a thrilling first half with a header from a Daniel Carvajal's cross right on the stroke of half time, but his effort went just wide.
It was almost four for the hosts on the hour mark as Benzema flicked the ball on to Bale, but the Welshman was denied by Valdes.
The turning point came just three minutes later as Sergio Ramos was adjudged to have pulled down Neymar inside the box, resulting in a penalty and a red card for the Spanish defender. Messi stepped up and made no mistake with his spot kick to level the scores.
Barca came within inches of taking the lead again with 15 minutes left of the match as Alves smashed an effort towards goal, only to see it come back off the post.
Messi completed his hat-trick with just six minutes remaining as Barca were awarded a second penalty for a foul by Xabi Alonso on Iniesta, allowing the Argentine to fire home the winning goal from 12 yards.