The United States beat Finland to finish second in Group A ©IIHF

Hosts United States set-up a quarter-final with Russia after finishing second in their group at the men's International Ice Hockey Federation World Junior Championships in Buffalo.

The Americans beat Finland 5-4 in their last Group A clash at the KeyBank Center to finish second behind rivals Canada.

It was a third win in four for the US, and their second in regulation time, as they edged a see-saw encounter.

The hosts, the defending champions, went 2-0 up in the first period as Trent Frederic and Casey Mittelstadt both registered.

Captain Joey Anderson then struck in the second period for the US to put them well in command at 3-0 but the Finns battled back.

Aapeli Rasanen fired in their first and it was 3-2 when Eeli Tolvanen netted on the powerplay. 

Anderson restored the two-goal American advantage before Finland's Joona Koppanen made it 4-3, and the home crowd were then stunned as Kristian Vesalainen equalised.

A dramatic encounter eventually did go the way of the US as Adam Fox won it with less than two minutes left.

"We're finding a way to win, and that's the main thing right now," said Anderson.

Sweden beat Russia and remain undefeated ©IIHF
Sweden beat Russia and remain undefeated ©IIHF

"We didn't play our best hockey at all times tonight. 

"There were periods of time when we stopped moving our feet. 

"We let them get their legs going, and suddenly it's a tie game."

Slovakia defeated eliminated Denmark 5-1 in the other Group A clash.

In Group B, Sweden finished top of the pile after beating Russia 4-3 in overtime, and remain undefeated.

Czech Republic saw off Switzerland 6-3 with all four sides in action going through to the last eight.

The quarter-finals will be played on January 2, with the US v Russia the stand-out tie.

Canada will meet Switzerland, Czech Republic will play Finland and Sweden will clash with Slovakia.