Joseba Llorente gave Osasuna a shock 17th-minute lead when he hooked in at the far post from a tight angle, but two goals in the final 15 minutes from the Argentine saw last season's runners-up in the division preserve their perfect start to the campaign.
Barca fell 3-2 to the Navarrans on a freezing February night last season but there was to be no repeat on a balmy summer evening in Pamplona as the World Player of the Year took his tally to four goals from two games.
Clad in their unfamiliar bright orange and yellow kit, Barca struggled to create chances and almost fell two behind midway through the second half when substitute Nino broke clear, but his shot spun out of play off the outside of a post.
The game turned in the 76th minute when Messi stretched to poke in an Alexis Sanchez centre, after which Osasuna midfielder Patxi Punal was shown a straight red card for his furious protests.
Messi, who set a La Liga scoring record of 50 goals last term, grabbed the winner 10 minutes from time, stroking a Jordi Alba centre low into the net from the edge of the area.
Barca have six points from two games and top the table on goal difference from Rayo Vallecano, who also have six after their 2-1 win at Real Betis on Saturday.