Christian Hoffmann of Austria clinched the silver and compatriot a Mikhail Botvinov won the bronze.
"My plan was to force the pace during the first few laps
and pull away"
Johann Muehlegg
The German-born Spaniard took the lead from the mass start and never looked back, to finish in a time of one hour, nine minutes and 28.9 seconds - more than two minutes ahead of Hoffmann.
Hoffmann looked as if he was going to setlle for bronze, before a final surge saw him fly past fellow Austrian Botvinov, eventually finishing 20 metres ahead of his countryman.
Gold medal favourite Per Elofsson of Sweden retired halfway through the race, having been trailing Muehlegg by two minutes.
The Spaniard had opened up a one-and-a half-minute advantage over a small group that included Norway's Ole Einar Bjoerndalen, Italy's Pietro Piller Cottrer, Kristen Skjeldal of Norway, Hoffmann and Botvinov.
Muehlegg stretched that lead to two minutes with six kilometres to go as the rest of the pack fought for silver and bronze.
"My plan was to force the pace during the first few laps and pull away from my rivals, and I did it," said the champion.
"I feel very good. The track was in great shape. It suited me because I've been training at altitude."