Party time in Helsinki
Markus Lauridsen and Peter Regin brought the Danes up to 2-0 in the first period, before Canada withdrew one.
Mathias Bau Hansen restored the two-goal cushion in the third period, and the Canadians could only muster a late goal to draw within one.
After the sound of the horn to end the game, the Danish players and fans celebrated the historic result.
The victory means that Denmark now only needs to draw Slovakia in their last match to reach the quarterfinals.
See the highlights from the historical game below.