Hanyu, 19, won a close competition with Canadian Patrick Chan to finish off an event that lost much of its luster when Russian Yevgeny Plushenko withdrew on Thursday due to a bad back.
Hanyu had the lead going into Friday's free skate thanks to a solid performance in the short program. That lead, however, was a long way from being insurmountable and the judges had a close call to make Friday.
They eventually awarded Hanyu's long program with a score of 178.64. Chen received a score of 178.10 for his performance Friday and the combined totals from the short and long programs put Hanyu ahead by 4.37 points.
The bronze medal went to Denis Ten of Kazakhstan, bringing that country its first medal of the Olympics.
With the Games nearing the halfway point, Kazakhstan became the 26th country with at least one medal. That equals the total from Vancouver four years ago.
Hanyu was among the favorites going into the Olympics, although he had not registered a victory at the senior world level. He was junior world champion in 2010, but his two trips to the world championships as a senior skater have brought about finishes of third and fourth.
Plushenko would have been hard to beat since he was skating on home ice, was a sentimental figure at the end of his career and already had a victory in the inaugural team event that was held on the opening weekend of the Olympics.
An as yet undiagnosed series of back spasms, however, forced him out of the competition.