Andres Iniesta has brought an end to months of speculation over his future by agreeing a "contract for life" with Barcelona, the club confirmed on Friday.
Iniesta's contract was due to expire next summer and he had expressed doubts about whether he would continue at the Camp Nou beyond then.
Speaking earlier this year, the Spain international said he was considering his future -- something that had previously been unthinkable.
Iniesta even knocked back a suggestion from Barca president Josep Maria Bartomeu in September that an agreement had already been reached in principle over a new contract.
However, Barca have now confirmed that a deal has been struck which they hope will see the 33-year-old remain at the club until he retires.
"Barcelona and Andres Iniesta have reached an agreement over a lifetime contract in a deal that will keep him at the club for the rest of his career," a statement read.
After signing his new deal with Barca on Wednesday, Iniesta said it had always been his desire to continue at the Camp Nou.
"Everyone can understand that someone who is 33 might start to consider things but I never thought, 'I'm leaving,' it was more a question of weighing things up," he said in a news conference when asked why it had taken so long for an agreement to be reached.
"This is an indescribable sensation, to come here as a 12-year-old and still be here at 33 and to think back on everything that has happened gives me goosebumps. I have so much sentiment and love for this club, this is my home, the best place I could hope to be.
"Today is a very special day for me, one of many here for the simple fact I'm continuing at this place which is my home, which means I can continue to aspire to win things for this club, my club. This is the club where I grew up and evolved and I feel privileged to be its captain."
The contract has no expiry date and will also allow Iniesta to continue at the club in a non-playing capacity when he decides to retire.
Bartomeu, stood alongside Iniesta at the news conference, explained the decision behind the unique contract.
"After 118 years of history, this is the first time the club has given someone a contract for life," he said. "This is an exceptional contract for an exceptional player.
"Andres has been part of this club since 2002 and won so many things. This golden era needs to continue and that's why we've signed this deal. This is a deal that will delight all Barca fans and will be a reference for future players."
Iniesta joined Barcelona as a 12-year-old and has gone on to make nearly 650 first-team appearances -- only Xavi Hernandez has played more games for the club.
Following Xavi's departure in 2015, Iniesta, who made his debut in 2002, has been the club's captain.