Lionel Messi has ended speculation about his future by signing a new contract with Barcelona until 2021.
Messi's previous deal had been due to expire at the end of the season, but this is the ninth professional contract the Argentine international has signed since he moved to the Camp Nou and commits him to the club until he is 34.
Barca announced the news in an official club statement, which read: "FC Barcelona and Lionel Messi signed on Saturday morning a new contract that will keep the Argentinian superstar at the Club through the 2020/21 season.
"The buyout clause was set at €700m. Thus, by the time the new deal expires, the 30-year-old striker will have spent 17 years with the first team."
Messi insisted he wants to finish his career with the club and keep on winning trophies with the La Liga leaders.
He told the club's official website: "I'm happy to continue with the Club, which is my home. My dream was to finish my career at Barca and we are moving down that path.
"The objective is to continue achieving things, fill the club's trophy cases, and keep making history at Barca. We've been lucky enough to have won a great many things and I hope there will be more in the future."
On his official Twitter account, Barcelona president Josep Maria Bartomeu said: "We are in luck with the Barça players. We continue to enjoy the best player in the history of football."
He added on the official site: "It's a great contract for the best player in football history. It fills me with pride to see him with us renewing his love for the Club.
"It's a new contract that we have signed today, because although the one we signed in June was up to par with his greatness as a player, the new one is more in line with the current situation in the ever-changing world of football. The buyout clause had to be modified, and it has gone from €300m to €700m."
Barca coach Ernesto Valverde said confirmation of the new contract was "positive" and that coaching Messi is a unique experience.
"We are all more relaxed now, above all because of all the noise [that was being made]," he told a news conference on Saturday.
"But we have already seen the commitment he has to this club. So we're really happy that it's done. Not many people will be at the same club for 21 years. It's a unique experience [to coach him], I'm not going to deny that. He's exceptional."
On the buyout clause itself, Valverde added. "I'm not an expert in buyout clauses and these things, but if we look at what happened with Neymar, it seemed as if no one would pay €200m. I suppose that's where we are now and why they've put the clause [at €700m]."
Messi avoided the chance to clear up the doubts about his Barcelona contract situation as he accepted the European Golden Shoe award on Friday.
Barcelona had already announced that Messi had agreed to a new deal until 2021 in July, but the forward had not yet signed the contract himself.
There had been some concern over his future as Barca allowed him to edge closer to the end of his deal.
At various points throughout the past year, he was linked with a move away from Catalonia, with a number of clubs reported to be monitoring the situation, including Manchester City.
However, Barca always remained optimistic that he would renew, telling ESPN FC in November that they were confident he would pen a new deal.
Messi joined Barca in 2001 from Newell's Old Boys, made his first-team debut against Espanyol in 2004 and has since gone on to win 30 trophies with the club, including eight La Ligas and four Champions Leagues.
Messi scored the first of his club record 523 goals -- they have come in just 602 matches -- against Albacete in May 2005 and has since claimed the Ballon d'Or on five occasions, more than any other player.