Hellner finished the race, held in freestyle, ahead of Norwegian Petter Northug and fellow Swede Emil Jönsson, who was third.
A double Olympic champion at the winter Games in Vancouver last year, the 25-year-old Hellner thus claims his first world title two years after finishing fifth in the sprint at Liberec in the Czech Republic.
"It was a perfect race," he told the TT news agency.
"I started thinking I could take the gold when I took the lead on the hill. But I tried to push it away. It's easy to lose focus when thoughts like that come."
Hellner's classical style kept him behind a number of skiers at the start of the race, but he soon found himself among the leaders once the competitors made it to the course's long incline.
Jönsson looked poised to capture the silver before Northug, known for his strong finishing sprints, eventually overtook the Swede to take second place, leaving the bronze to Jönsson.
Following the race, Northug also praised Hellner's gold-winning performance.
"Marcus was best in the world today. I tried to catch him on the slop, but I was surprised at how we was able to draw away from the whole pack," the Norwegian told TT.