The American was stunning in the free skate after being third in the short. 17-year-old Kagiyama holds steady for the silver medal, while Hanyu earns the bronze.
Call it a comeback for now three-time world champion Nathan Chen.
In third place after the short program, the 21-year-old American roared back with a chilling free skate to seal a third consecutive victory in the men's singles event at the ISU World Figure Skating Championships in Stockholm, Sweden, Saturday afternoon (28 March).
It's his 10th international gold in a row heading into the Olympic season for Beijing 2022. Chen has not lost an event since the PyeongChang 2018 Winter Games.
Chen jumped (quite literally, hitting five quadruple jumps) past two-time Olympic champion and short program leader Hanyu Yuzuru, as well as rising Japanese teenager Kagiyama Yuma, only 17. Kagiyama held steady for silver, while Hanyu won bronze.
Chen won with an overall score of 320.88 (222.03 in the free), followed by Kagiyama with 291.77 and Hanyu at 289.18.
"This is one I'm going to remember forever," Chen said after his win. "It's amazing - the fact that we're able to be at this worlds after this unprecedented year... I'm very elated, I'm very happy. I tried to remind myself to enjoy being here. I don't know how many more worlds I'll be at. In doing that, I was able to be a lot more calm."
2018 Olympic silver medallist Uno Shoma was a stronger version of himself vs. the short program, rising from sixth to fourth, meaning Japan went 2-3-4 on the day. Uno scored a 277.44.
2018 world bronze medallist Mikhail Kolyada (272.04) continued his resurgent season with a fifth-place finish, while Canada's Keegan Messing (270.26) was excellent in the free skate, too, earning sixth.
American Jason Brown (262.17) had a stirring free skate himself, successfully landing an under-rotated quad Salchow - a rarity for him - and securing his spot among the elite men with a seventh-place finish.
Each of the U.S., Japan, and the Figure Skating Federation of Russia (FSR) secured three spots for next year's Olympics, while Canada, France and the Republic of Korea have two. Some of those spots are provisional - to be confirmed next season.
Evgeni Semenenko (FSR) was eighth, Kevin Aymoz (FRA) ninth and Cha Jun-hwan (KOR) 10th.
It was a disappointing day for China, the host of the Games next year - neither former world medallist Jin Boyang nor Yan Han finishing inside the top 10.
Like at the Olympics three years ago, Chen used a disappointing short program to bring his best into the free skate.
In PyeongChang he was in 17th, too far off the top skaters - Hanyu included. This time he was only third, however, and eight points back from Hanyu, who had been ethereal himself in a brilliant short program.
Skating to a Philip Glass medley choreographed by Shae-Lynn Bourne, Chen's lightness between jumps translated into explosive power, as he hit a quadruple Lutz to open the program - the jump he fell on in the short - then quad flip-triple toeloop in combination. From there, Chen would connect on a triple Lutz, quad Salchow, quad toe-Euler-triple flip combo, quad toe-triple toe combo and a triple Axel to finish, a jump he said he struggled with into the free.
"As soon as I hit that [triple Axel], I felt a sense of relief that I had hit everything into the step sequence," Chen said.
On his mentality, he said not much changed from the short to the free, only reminding himself to enjoy the moment: "It's been a while since I've skated at internationals, so I forgot how to mentally prepare for these events.
"I just try to remind myself how fortunate we are to be here. That relaxes me. 'Be here, be present.' We train for these moments, we live for these moments. Without these, it's pointless what we do every day." - Nathan Chen on his mentality
Olympic Channel's Meryl Davis, the 2014 Olympic ice dance champion, was watching in from home. She said about Chen:
"A master at work. From the onset, Nathan appeared to be very much in the zone and seeing the standing ovation from his fellow athletes at the end really says it all; so much respect for this exceptional athlete."
It was not to be on the day for Hanyu, who was world champion in both 2014 and 2017 and led after the short program here. But he put his hand down to stay upright on an opening quad loop, and was called a quarter under on his next quad Salchow. The two jumps took the edge off his program - enough of an assurance that the gold wasn't to be his this worlds.
"'I was losing balance one by one and I couldn't bring back my equilibrium," Hanyu told reporters in Japanese. Though, he added: "What I was mindful of during the training - all of it I was able to put on the ice anyways."
His free skate, set to "Heaven and Earth", is both moving and emotional. Despite his errors he earned 92.40 in program components, second only to Chen.
"I feel so exhausted," he added. "I was trying my best not to fall and to get it together. There were a lot of jumps one after another that didn’t really feel [like me]. So it was really challenging."
Hanyu still has his eyes set on the yet-to-be-done quadruple Axel.
"I don’t know when that next competition would be. But if I have time, I’d like to practice quad Axel as soon as possible. I want to work on perfecting my landing and incorporate in competitions." - Hanyu Yuzuru on what comes next
What a difference a year makes. In January of 2020, Kagiyama won gold at Lausanne 2020, the Youth Olympic Games, a victory that has set off a series of big firsts for the youngster, still just 17.
He's coached by his father, two-time Olympian Kagiyama Masakazu.
After a stirring short program, Kagiyama was equally strong in the free, hitting three quadruple jumps (Salchow, toe in combination and another toe) in an Avatar and Lord of the Rings medley.
The teenager was elated as his scores came through, his placement behind Chen securing him a podium spot, that position being silver once Hanyu had skated. He is the youngest medallist at worlds since - 2012, when a 17-year-old Hanyu won bronze.
"The most earnest and lovely celebration in the kiss and cry for Yuma's incredible podium finish at his first world championships - an accomplishment made all the more incredible when considering the depth of this tremendous field," Davis described of Kagiyama, who leapt for joy as his scores came up. "Hard to imagine a stronger or more exciting debut for this young athlete."