Not only did Hanyu fall on his opening jump, a quad salchow, but he also crashed on his third, a triple flip. That left plenty of room for Canada's Patrick Chan to skate through to the top of the podium, but he made three errors in a watered-down program to finish second.
Canada has never won the event, either.
Kazakhstan's Denis Ten, the world silver medalist, won bronze in Sochi in a final that was a two-man showdown between Hanyu, now the first Asian man to win an Olympic title, and three-time world champion Chan.
Neither performed close to his peak on a second consecutive night of competition. Most skaters appeared fatigued, particularly at the end of their 4 1-2-minute free skate routines.
Chan skated directly after Hanyu with a chance to do what such renowned Canadian men as Donald Jackson, Kurt Browning, Elvis Stojko and his own coach, Brian Orser, could not. But he wasn't sharp either, and the difference at the end was pretty much Hanyu's nearly 4-point margin carried over from Thursday's short program.
When the 19-year-old Hanyu finished, kneeling, he laid two hands on the ice for a long time, thinking he had blown it.
"I was so nervous and I was so tired," he said. "But I was surprised (to win). I was not happy with my program."
Orser told him not to fret, that the competition wasn't over. And when Chan came up short, as nearly every man did in the free skate, the gold was headed to Japan.
Asked if he thought he would win, Hanyu shook his head.
"No, I was so sad," he said.
But he was thrilled when the final results were posted, and he skated around the rink draped in a Japanese flag after the flower ceremony. Around the Iceberg rink were about two dozen banners supporting him and the Japanese team.
American Jason Brown, 19, of Highland Park, Ill., fell from sixth to ninth, earning no points for a triple loop at the end of his program because of a previous false takeoff that was counted as a jump.
Four-time U.S. champion Jeremy Abbott, of Aspen, Colo., rallied from 15th to 12th place.
Javier Fernandez, seeking Spain's first Olympic figure skating medal, struggled and fell from third to fourth. He repeated a triple salchow without putting it in a combination, costing him precious points.
Japan's Daisuke Takahashi, the 2010 bronze medalist and among the most popular skaters in the event - there were Dice-K signs throughout his rooting section - had a flawed if gorgeously choreographed program to a Beatles medley. He finished sixth, one spot behind countryman Tatsuki Machida.
That gave Japan half of the top six finishers, spectacular for a nation that until 2010 never stepped on the men's podium.
AP Sports Writer Rachel Cohen and freelancer Marie Millikan contributed to this story.