Xavier had requested to change his gender from male to female.
Court records show that the 18-year-old also requested to change his name from Xavier Alexander Musk to Vivian Jenna Wilson.
His new last name is the maiden name of her mother, Justine Wilson.
A Los Angeles County Superior Court judge ruled for the issuance of a new birth certificate to reflect the changes.
Vivian is one of five children Elon Musk shares with Justin Wilson, a 49-year-old Canadian author.
The duo got married in 2000 and separated in 2008.