After announcing his intention to quit the club, Lionel Messi said on Friday that he will now stay at Barcelona and honour the last year on his current contract.
The Argentine player had informed the management at Barcelona that he wanted to exercise a clause in his contract that would allow him to leave for free.
But the club insisted that a €700 million buyout clause would have to be met.
The decision ends weeks of uncertainty over Messi's future at the crisis-hit club.
The news is being hailed as a victory for the club's president, Josep Maria Bartomeu whose management has been widely criticised and was on the brink of resigning.
Bartomeu and incoming coach Ronald Koeman said the team’s restructuring project revolved around the Argentine forward, so convincing him to stay was key to helping lift the club out of one of its worst crises ever.
“The president [Bartomeu] always said that at the end of the season I could decide if I wanted to go or if I wanted to stay and in the end, he did not end up keeping his word,” Messi said.
Messi, who has been a fixture at the club for nearly two decades, told the club he wanted to leave nine days after Barcelona's humiliating 8-2 aggregate defeat to Bayern Munich in the quarter-finals of the Champion's League.
Barcelona claims the clause expired on June 10 and told Messi he had to stay until the end of his contract or pay the buyout clause.
There had been no agreement when Messi’s father and Bartomeu met on Wednesday to discuss the player’s future, with Jorge Messi saying his son wanted to leave and Barcelona saying it would not facilitate his transfer.
“I’ll continue at Barcelona and my attitude won't change, no matter how much I have wanted to go,” Messi told Goal.com, a football news site.
“I told the club and the president that I wanted to go. I’ve been telling him all year. I thought my time in Barcelona was over, sadly — I always wanted to finish my career here.
"I would never take Barca to court as it is a club I love, that has given me everything since I arrived. It's the club of my life," he added.
"I have made my life here. I know that it never crossed my mind to take Barca to court."