Just seven weeks after the March 11 earthquake and tsumani killed at least 13,000 people in Japan, an event which forced the World Championships to be moved from Tokyo, Ando showed her nerves of steel to clinch her second world title with a combined total of 195.79 points.
Kim finished with 194.50.
"Maybe I was able to bring back a little smile to the people of Japan," said Ando, who had won her last world title on home ice in Tokyo in 2007.
I'm so happy to win this gold medal.
"I did it for myself and for Japan."
Ando trailed Kim by less than half-a-point after yesterday's short programme but was able to snatch gold after earning 130.21 points for her free skate.
Asked to compare her two titles, Ando said: "Four years ago I didn't have any idea of any medal.
"I had a serious injury then and I didn't skate for two weeks. I just did my job and won."
The modest 23-year-old was also critical of her own performance.
"I wasn't perfect today, I had some small mistakes," said Ando.
Kim had to settle for silver for the second year running following a shaky performance.
Her combined total was almost 35 points adrift of the record score she posted during her gold-medal performance at last year's Vancouver Games.
Kim, known as "Queen Yuna" to her legion of fans, tried to be positive about her silver medal.
"I'm very happy with this medal because I've had the hardest time in my life after the Olympics," said the 20-year-old, who briefly considered retirement after being upstaged by Asada in Turin before changing her mind, and also fired her Canadian coach Brian Orser last August.
"I was thinking what to do next.
"Then I started skating again but mentally it was very difficult.
"Now, I can go home, relax and do my [ice] shows.
Italy's 2010 European champion Carolina Kostner was rewarded for a difficult programme, moving up from sixth to take bronze.
Japan's Mao Asada, who beat Kim to win gold at last year's worlds, had a day to forget, finishing a disappoiting sixth.
April 2011: Late replacement Moscow ready to host World Skating Championships
March 2011: Moscow chosen to replace Tokyo as host for World Skating Championships
March 2011: Putin offers to step in and pay for Moscow to host World Skating Championships
March 2011: Earthquake forces cancellation of World Skating Championships
March 2011: World Figure Skating Championships in Tokyo in doubt after earthquake