The Argentina superstar put pen to paper on his new deal at the Nou Camp on Thursday afternoon.
Messi follows in the footsteps of fellow club stalwarts Xavi and Carles Puyol, both of whom signed their extensions last month.
Barca announced in December they had agreed new contracts with the trio.
Barca defender Jordi Alba is delighted Messi, who will be 31 when his new deal expires, has committed his long-term future to the club.
"I can't imagine what Messi will be like in 2018, but it's great news for Barca fans that he's staying," said the Spain international.
"He is the best player in the world and as long as nothing happens, he'll be the best ever. We'll try to make him feel as comfortable here as we can."
Messi, 25, came up through the youth ranks at Barca before making his competitive debut against Espanyol in 2004 at the age of 17.
Since then he has established himself as one of the best players in history, breaking numerous records in the process.
He won his fourth straight FIFA World Player of the Year award last month following a remarkable 2012 in which he scored 91 goals - smashing the world record of 85 in a calendar year set by Bayern Munich and West Germany striker Gerd Muller in 1972.
While setting that record, Messi became the first man to score five times in a Champions League game as Barca crushed Bayer Leverkusen 7-1 last March.
Three weeks after that he became Barca's all-time leading goalscorer after a brace against Granada moved him on to 233 official goals, one more than the previous record set by Cesar Rodriguez during the 1940s and 50s.
He has been in similarly stunning form in 2013 and his goal in Sunday's 1-1 draw at Valencia was a league-record 12th consecutive game in which he found the net.
During his time at the Nou Camp, Messi has also helped Barca win a host of silverware, including five Primera Division titles, three Champions Leagues, two Copa del Rey crowns and two FIFA Club World Cups.