The 43-year-old, who is the only player to feature in a Merseyside derby for both teams during the same season, has signed a two-year deal to manage the African nation and begins his role on February 1.
Mozambique, who are 109th in the latest Fifa world rankings, are Xavier's fourth managerial role after most recently being sacked after less than two months with Portuguese outfit Aves.
"I have followed the Mozambican team for years," Xavier, who made 20 appearances for Portugual but was born in the African nation, told reporters. "I am very proud to come back to my country."
READ MORE | Suarez talks Liverpool return
Xavier served an 18-month suspension for doping in 2005 when he was playing for Middlesbrough, and since ending his playing days in 2008 he has endured a topsy-turvy coaching career.
His first job came at Portuguese top-division side Olhanense, where he lasted just three months, before spending a five-month stint at Farense in Portugal's second division.
Last July he was handed a one-year contract with Aves - also in Portugal's second division - where he was coach until September.
Alberto Simango Junior, president of the Mozambican Football Federation said he hoped Xavier could bring "good results", adding the appointment showed the ambition of the national governing body.