Adam Fox scored with 1:20 left in the third period to give the United States a 5-4 victory over Finland on Sunday in the Americans' final preliminary-round game at the world junior hockey championship.
The defending champion Americans (3-1) finished second behind Canada in the Group B standings and will face the Czech Republic or Russia in the quarterfinals Tuesday.
Fox also had two assists, Joey Anderson scored twice, Casey Mittelstadt had a goal and an assist on Fox's winning goal, Brady Tkachuk added three assists, and Joseph Woll stopped 20 shots.
"We are really confident and we believe in our group," Tkachuk said. "It's a new tournament now, it starts on Tuesday, and we are excited."
Canada (3-1) secured the top seed in Group A because of the point earned in its 4-3 shootout loss to the U.S. at the Buffalo Bills' New Era Field on Friday. Canada will meet Switzerland in the quarterfinals.
Earlier Sunday, Kristian Reichel scored twice in the Czech Republic's 6-3 victory over Switzerland.
The Czech Republic (3-1) moved into second place in Group A. Russia (2-1) can take that spot with a regulation victory over Sweden (3-0) in its final preliminary game Sunday night.
In a matchup between the American and Finnish teams that have won four of the last five gold medals, Finland came back from a three-goal deficit to tie it before Fox scored the winner on a partial breakaway after a lead pass from Mittelstadt.
Kristian Vesalainen and Joona Koppanen scored 66 seconds apart for Finland midway through the third period to tie it.
Trent Frederic and Mittelstadt scored in the first 15 minutes and Anderson's goal on a 5-on-3 power gave the U.S. a 3-0 early in the second period. Aapeli Rasanen and Eeli Tolvanen got Finland within a goal before Anderson scored again on a power play in the closing minutes of the second.
"We didn't play our best hockey tonight at all times but we found a way to win," said Anderson, the U.S. captain.
Ukko-Pekka Luukkonen made 32 saves for Finland.
Mittelstadt, the University of Minnesota freshman and most recent first-round draft pick of the Buffalo Sabres, leads the tournament in points (eight) and is tied for the lead in goals (four). Mittelstadt assisted on all three regulation goals in the comeback victory over Canada.
Tkachuk, a Boston University freshman and one of the top prospects eligible for this year's NHL draft, set up Mittelstadt's goal with a deft pass in front of the net. Tkachuk scored the tying goal and shootout winner against Canada in Friday's outdoor game that set a tournament attendance record of 44,592.
Kristian Reichel scored two goals to lead the Czech Republic over Switzerland. Martin Necas, Daniel Kurovsky and Martin Kaut each had a goal and an assist. Jakub Lauko also scored and Libor Hajek had two assists.
Ken Jager, Dario Rohrbach and Elia Riva had goals for Switzerland (1-3), which finished fourth in Group B. The Swiss have never beaten Canada in 21 world juniors meetings.
Copyright 2017 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.