The 34-year-old won the World Cup and two European Championships with his country.
He was capped 133 times, more than any other Spanish outfield player, and scored 13 goals.
Xavi told a news conference in Barcelona on Tuesday: "I'm grateful for all those years. It has been a fantastic time."
For breaking stories and all the great banter like us on Facebook: facebook.com/tribalfootball