Sweden, last year's runner-up, started confidently and had gone 4-0 up in the opening period following a pair of goals each for Viktor Stålberg and Loui Eriksson.
Nichlas Hardt netted a consolation when the Danes were on a two-man powerplay.
Ottawa Senators forward and Sweden skipper Daniel Alfredsson put the Swedes
back in control only 43 seconds after the restart and Jonas Brodin added a fourth as Hardt scored his second powerplay goal of the match.
In the third period Denmark picked up steam, scoring twice through Lars Eller and Morten Green but in the end it was too little too late.
In the late match in Helsinki the United States, seeking their first world crown since 1960, failed to regain top spot in their group after succumbing to a 4-2 defeat at the hands of 2002 champions Slovakia.
Starting with no room for error after two opening defeats, the Slovaks got off to a flying start through Dominik Granak who scored after just 47 seconds.
Forward Branko Radivojevic and Buffalo Sabres defender Andrej Sekera added one apiece for Slovakia before the first interval, while Carolina Hurricanes rear guard Justin Faulk scored for the USA.
Paul Stastny of Colorado Avalanche reduced arrears further with 1:13 remaining in the second period when two Slovaks were in the penalty box.
In the third period the Americans stormed the Slovaks' net seeking for an equalizer and substituted their goalie for the sixth field player with 1:04 remaining. The Slovaks responded through Miroslav Satan who scored into the empty net.
"Finally after losing in the first two games here we managed to play a good match and record points tonight," Slovakian manager Vladimir Vujtek said.
"The first period was decisive in this game as we took an advantage, which allowed us to keep the play under control later in the match."
In the early Stockholm group match the Czech Republic were pushed all the way by Norway, who took last year's bronze medal winners into overtime before succumbing to a 4-3 defeat following a penalty shootout.
The Czechs dominated play but Norway took the lead through Mathis Olimb on 11:16 as two Czech players served minor penalties.
The Czechs pulled level with 3:19 remaining in the first period through Edmonton Oilers forward Ales Hemsky but Lars Erik Spets restored Norway's lead 1:39 into the second period.
Boston Bruins' David Krejci and Chicago Blackhawks' Michael Frolik scored one apiece to put Czechs in the lead but they failed to keep it as Norway defender Jonas Holos made it 3-3 with a powerful slap shot.
After a goalless overtime it went to a shootout.
In the three-attempt series the Czechs scored once while the Norwegians squandered all three of their attempts.
"My team is still searching for its best hockey," said the Czech coach Alois Hadamczik.
"We need time to fine-tune. We're still alternating good periods of play with bad. Luckily, today we managed get two points against the brave Norwegians."
In Helsinki's earlier match Vancouver Olympic champions Canada were in complete command against minnows France, coming away 7-2 winners to jump into top spot of their table.