The Argentine put pen to paper on an improved contract on Monday after meeting president Josep Maria Bartomeu with his father at Camp Nou
The Argentina international reached a provisional agreement over a new deal at the end of last week following months of speculation that he had reached an impasse over fresh terms.
The 26-year-old released a statement earlier on Monday claiming he could be forced to consider his options should he no longer feel the "affection" of the club he joined as a youngster, though he maintained he was eager to continue his Camp Nou career.
"FC Barcelona would like to announce that Leo Messi and the Club signed a revised contract this afternoon," a statement on the club's official website read.
"The signing took place in the presence of Leo Messi, his father Jorge Messi and the Club President Josep Maria Bartomeu, as well as the sporting vice-president Jordi Mestre and the Club CEO, Antoni Rossich.
"During the signing, which was made in the Presidential Box at the Camp Nou, Leo Messi repeatedly expressed his excitement about the new deal."