Vivian Jenna Wilson filed the petition in Los Angeles County Superior Court the day after turning 18 in April.
She listed gender identity and an apparent dislike of her father, as the reason for the change.
"I no longer live with or wish to be related to my biological father in any way, shape or form," she wrote on the petition.
Judge Rafael Ongkeko approved the petition Wednesday in the Santa Monica courthouse after no one objected to the change. A hearing that had been scheduled for Friday was canceled. The court order said a new birth certificate would be issued reflecting the change.
Vivian will now legally use the last name of her mother, Canadian author Justine Wilson, who was married to Musk from 2000 to 2008.
The couple had five children, the oldest of which died as an infant. Vivian has a twin brother.
Musk has been married three times, including twice to "Westworld" actress Talulah Riley. He has two young children with the singer Grimes.
On Father’s Day, Musk tweeted: "I love all my my kids so much."
Musk, 50, who is currently trying to buy Twitter for $44 billion, has previously said he supports transgender people, though he was criticized for dismissing the use of different pronouns.
"I absolutely support trans, but all these pronouns are an esthetic nightmare," he tweeted in December 2020.
In July 2020, he tweeted "Pronouns suck."
The Associated Press attempted to reach Vivian Jenna Wilson for comment but phone calls were not answered and text messages were not immediately returned.