Xavi, who will be 33 at the end of next month, enrolled in Barca's youth academy in 1991 at the age of 11 and made his debut for the first team in a Spanish Super Cup match against Real Mallorca in 1998.
Considered one of the finest playmakers of his, or any, generation, he has helped the club win 20 trophies, including three Champions League crowns and six La Liga titles.
He has also been at the heart of Spain's success in recent years, playing a key role in their triumphs at Euro 2008 and 2012 and the 2010 World Cup.
"The two sides didn't take long to reach an agreement and all that remains is to sign the contract," Xavi said at a post-training news conference when asked about the negotiations.
"My dream of seeing out my career at Barca will come true," he added.
"I'm very happy to be able to finish here. If I can still be here at the age of 36 it will be a privilege.
"This is my lifelong club. For the moment I just want to enjoy myself until 2016."
Xavi's current deal runs through 2016 but the final two years are contingent on the number of appearances he makes.
He has already featured in more official matches than any other Barca player, overhauling Migueli's previous club record of 549 in early 2011.
Barca also announced on Thursday they had agreed to extend Spain Under-21 winger Cristian Tello's contract until 2016.