Messi created Barcelona’s first goal with a superb through ball which Andres Iniesta chipped over Iker Casillas.
Cristiano Ronaldo then tapped home Karim Benzema’s ball into the box, but Messi restored the lead just before half time, playing a superb one two with Gerard Pique in a crowded penalty area before chipping over Casillas.
But with minutes left, Benzema fired home after a corner wasn’t cleared.
With the game heading for extra time, Cesc Fabregas released Messi, who played in Dani Alves, and whose cross was then volleyed home spectacularly in the last moments by the Argentine.