Co-hosts Finland were also beaten, losing 5-3 to Canada in Helsinki.
Goaltender Cam Ward was the hero for the Canadians, saving 35 of 38 shots as they leapfrogged the Finns at the top of Group H.
Finland led 3-1 midway through the game but Canada then clicked into gear.
Jeff Skinner made one and scored one before Evander Kane put Canada in the lead for the first time six minutes into the final period. Jordan Eberle fired the puck into an empty net in the dying seconds to secure victory.
Canada have 13 points, one more than Finland.
Sweden suffered a humiliating third-period collapse, letting in four goals against Russia having earlier gone into a 3-1 lead.
Indiscipline late in the second period led to two powerplay goals for the Russians, Malkin netting his first and Alexei Yemelin scoring two minutes later to make it 3-3.
Fifteen seconds into the third session Alexander Perezhogin added a fourth goal.
Malkin then struck twice more as Sweden failed to capitalise despite being a man up for five minutes when Dmitri Kalinin was penalised for cross-checking Johan Franzen in the face.
Russia now have five wins from five games.
Elsewhere, Czech Republic destroyed Italy 6-0 in Group S and United States squeezed past Kazakhstan 3-2 in Group H.