Barca appeared set for their first defeat under coach Tito Vilanova, who was sent from the dug-out for complaining to the referee midway through the second half, before Messi came to the rescue.

Barcelona’s Lionel Messi (centre) celebrates a goal with teammates. Pic/AFP

Osasuna was the scene of a Barca defeat last season that helped to turn the title race against them and they went behind this time after a 17th-minute goal from Joseba Llorente.

After the visitors missed a hatful of opportunities, the game appeared to be going against them, until Messi rose to the occasion with strikes after 75 and 80 minutes.

Osasuna’s Francisco Punal was red-carded by the referee for protesting about the Argentine’s first strike, as he felt he was offside.

Victory provisionally took Barcelona top of the early-season standings, above Rayo Vallecano on goal difference.