The victory lifted the Finns above Russia in the Helsinki group and set them up for a quarter-final meeting at home to Slovakia on Thursday.
Beaten finalists in 2012, Slovakia left it late to progress from their group, booking their quarter-final spot by beating the United States 4-1 in their final pool match in Helsinki.
That result means the United States, who finished third in the Helsinki group, will face a tough quarter-final test against defending champions Russia, who suffered two surprising defeats en route to second place in the Helsinki group.
In Stockholm, Martin Bieber had one goal and one assist as Switzerland beat Belarus 4-1 to round off their best performance in the group stages at the world championships.
The Swiss fired 40 shots at the Belarus goal en route to their seventh straight victory as they secured victory in the Stockholm group.
Their reward is a quarter-final meeting with the Czech Republic, who hammered Norway 7-0 to secure fourth spot in the same group.
In the late game in the Swedish capital the Sedin brothers, Daniel and Henrik, both scored as Sweden saw off Denmark 4-2 and booked a quarter-final meeting at home to Canada on Thursday.
The Sedins were playing their first game of the tournament, having arrived over the weekend from NHL duty with the Vancouver Canucks. Sweden finished in third place in their group, behind Switzerland and Canada and ahead of the Czech Republic.
Christian Ehrhoff scored twice for Germany, including an overtime winner, as they beat France 3-2, but Slovakia's win meant the Germans finished the group in fifth place, missing out on the quarter-finals by one point.
Co-host cities Stockholm and Helsinki will stage two quarter-finals each on Thursday, before the focus switches to the Swedish capital for the semi-finals and final on Saturday and Sunday.
- Sports & Recreation