Canada came away defeated after a penalty shootout against Finland 24 hours earlier to end their perfect record, while Sweden were not only perfect having won six from six, but were well-rested having not played since beating France 4-0 on Saturday.
But none of that matched up with what happened in the opening 18 seconds of the game.
Canada won the faceoff, maintained possession and worked the puck into Swedish territory before Nathan MacKinnon found Travis Sanheim, who forced his way in front of goal and squeezed the puck past Jacob Markstrom at the second attempt.
It was the first goal Sweden had conceded in four matches, but an equaliser less than four minutes later showed their confidence had not been dented.
With Marcus Johansson in the box for tripping, Canada had the advantage, but Elias Lindholm stole the puck within his own blue line and raced away to beat Jordan Binnington to score shorthanded.
Once again, parity would not last long - in the eighth minute, the Canadians were back in front when a long pass down the right wing found Tyson Foerster, who used his strength to hold off the defender, skate in front of goal and beat Markstrom.
The lead was stretched to two with seven minutes left in the first as Ryan O'Reilly got in on the act. MacKinnon won possession in the Swedish zone and passed to Travis Konecny, who laid the puck across for the Nashville Predators man to score.
In the second period Canada offered the Tre Kronor a route back into the match when both Will Cuylle and Brayden Schenn were penalised to give Sweden a 5-on-3, which they took little time to take advantage of.
Filip Forsberg collected the puck on the left side of the net and played a clever pass across the paint to the unguarded Johansson who made it 3-2.
Team Canada were struggling to keep their discipline, but Sweden failed to profit from two more powerplays before finding themselves two goals down again just past the midpoint of the match.
Sidney Crosby sent Macklin Celebrini away down the ice, and the San Jose Sharks teenager used excellent pace and skill to swerve past Markstrom and tuck the puck home.
4-2 was how it stayed at the end of two periods, in which Sweden had conceded more goals than their entire first six games combined.
With two assists each already, it was fitting that the goal, which all but sealed the win four minutes into the third period, would be scored by MacKinnon on a pass from Konecny.
Konecny had his back to goal and was falling to the ice, but still had the ability to play a backhanded pass to MacKinnon who beat the committed Markstrom with ease.
Sweden kept fighting and after Alexander Wennberg and Isac Lundestrom were denied by desparate defending, the hosts finally pulled a goal back with three minutes to play courtesy of Rasmus Andersson forcing the puck against the post before it ricocheted in off a defender.
But that was nothing more than a consolation for Sweden, as Canada took a 5-3 victory to win Group A with 19 points, one clear of Sweden, ahead of fellow Quarter-finalists Finland and Austria.
In the Quarter-finals on Thursday, Sweden will take on the Czech Republic, while Canada will face Denmark , who beat Germany on penalties to snatch the final place in the last eight.
Click here to read about how the Danish side extended their stay at their own tournament in the most dramatic fashion, and for a roundup of today's earlier action in Group A, click here.
Earlier in Group B in Herning, Kazakhstan were relegated to the second tier as despite taking the lead, they ran out of steam in the final 20 minutes to lose 4-1 to Switzerland, before four goals in the final period for the USA saw them see off the Czech Republic 5-2 as both warmed up for the Quarter-finals.