Simone Biles made history by becoming the first woman to win four all-around titles at the World Championships.
Biles had not competed internationally since the 2016 Olympics, while she revealed in January she had been sexually abused by a former Team USA sports doctor.
In addition, the 21-year-old American was admitted to hospital with a kidney stone on the eve of the Worlds.
"This is definitely the scariest one from the ones from the past," she said.
Biles had previously shared the record of three all-around world golds with Svetlana Khorkina of Russia.
"This year has definitely had its ups and downs, going to therapy and other things besides. Just being in the gym has been a little bit rough, but you try to focus on one thing at a time to get through it," she said.
"I hope this gives confidence [to other women] that you can still do well and not be penalised for it and for parents to put gymnasts in the sport and feel comfortable."
Britain's Ellie Downie, 19, finished 11th on her return to competition after two operations on her left ankle.
On Saturday, Downie takes part in the uneven bars final, while double Olympic champion Max Whitlock will aim to win a third successive world title on the pommel horse.
Biles takes 12th world gold despite errors
Biles had errors on vault, beam and floor but her total of 57.491 was enough to beat Japan's Mai Murakami into silver and USA's Morgan Hurd into third.
A backward roll on landing on vault and a fall off the beam left her almost three full marks down on her qualifying scores.
Uneven bars was the Olympic champion's cleanest routine, despite it traditionally being her weakest discipline.
Going last on the floor she needed a score of 13.307 to overcome Murakami to take gold and, even with a step out of bounds, Biles scored 15.00 to seal the title by 1.693 marks.
"I wish I could have put out a better performance because that's not the gymnast that I am," added Biles, who won four gold medals at the 2016 Olympics.
"But we all make mistakes and fall - it's just how you get up and prove yourself."
Biles helped the United States to an emphatic women's team gold earlier in the week and her latest victory saw her win a 12th world title.
She has earned 15 World Championships medals, which is five behind the record holder, Khorkina.