Messi's current deal with the Catalan club expires in 2018 and the Primera Division champions have not yet reached an agreement over an extension for the Argentina international.
Xavi is confident the 29-year-old will stay at the Spanish side, saying Barca needs the player just as much as the player needs the club.
The Spanish legend told TV3: "I am convinced Messi will sign a new deal. Barcelona need Messi, but Messi also needs Barcelona.
"He looks happy to me, more mature and calm than ever before. I cannot see him changing clubs, but we have to act swiftly.
"It would be a historical mistake for Barcelona not to renew Messi's contract.
"Leo is the best player in history. His importance will become even more clear once he retires."