Lionel Messi has agreed terms on a new contract at Barcelona until 2021.
The club say the deal will be signed in the coming weeks as Messi returns for pre-season training.
"'The club is very happy with both the renewal and the commitment of Messi, the best player in history, who has played his full professional career at Barca and has led the team to an era of extraordinary success, the likes of which has never been seen in world football," said Barca in a statement.
Talks over a new deal were reported to have been ongoing for months, with Messi's previous deal set to expire in June 2018. There were even rumours that the 30-year-old could move to the Premier League, but he has now committed his future to the club he joined at the age of 13.
As expected Messi renews his contract with Barcelona til 2021. A doubt remains -can FCB make a competitive team to match his ambition?— Guillem Balague (@GuillemBalague) July 5, 2017
Messi is Barcelona's record scorer with 507 goals in 583 matches, and is also the leading scorer in La Liga history with 349 goals.
He has won the Ballon d'Or on five occasions and has won 30 trophies with Barcelona, including La Liga eight times and the Champions League four times. His only trophy-less season with Barcelona came in 2007/08.
Barca are set to start their pre-season on July 12 under new head coach Ernesto Valverde.