Halvorsen completed a team effort when he beat Germany’s Pascal Ackermann and Jakub Mareczko from Italy on the line in a bunch sprint at the end of the 165.7km race.
Jason Lowndes was the best placed Australian, sprinting to sixth place after a lead out by team-mate and time trial bronze medallist Miles Scotson.
“My teammates were so good, they’ve been working so hard, I’m incredibly happy,” Halvorsen said. “The course was perfect for me and this was my biggest goal for this season.”
The 20-year-old Halvorsen followed the footsteps of fellow countrymen Kurt Asle Arvesen and Sven Erik Bystrøm, who captured the Under 23 title in 1997 and 2014.
Ackermann appeared to on course to a world title entering the final straight, only to be pipped on the line by Halvorsen.
"The race was tough and fast,” he said. “The final sprint was a little too long for me. But I'm happy with how I did.”
Italy’s Mareczko managed to place himself well for the final sprint and rolled to bronze.
“I could sprint well only in the last 150 metres, but it was too late,” he said. “I’m still happy with the bronze."
The race came to a head after a seven-rider break was caught with 10 kilometres to go. Norway was in the driver’s seat, with France, Denmark and Germany in the mix.
France and Germany set the pace in the final five kilometres, but the Norwegian train again massed at the front after passing under the final kilometre kite.
The final sprint was a close call between Ackermann and Halvorsen, but it was the Norwegian who lived up to expectations.