Max Domi scored two goals as Canada topped the United States 5-3 to finish first in its preliminary round group at the world junior hockey championship on Wednesday.

Team captain Curtis Lazar and Sam Reinhart also scored for Canada (4-0-0), which advanced to a quarter-final in Toronto against the fourth-place team in the Group B.

Canada led 3-2 late in the third when Domi scored into an empty net. Dylan Larkin, with his second of the game, got one back for the U.S., and Domi got another empty-netter with five seconds left to play.

"I thought we had good flow," Lazar said. "Give credit to the Americans. They made it quite interesting at the end. I was freaking out a bit, but we found a way to win in the end"

Anthony DeAngelo also scored for the U.S. (2-1-1), which finished second in its pool and will stay in Montreal to play the third place team in Group B.

Canadian goaltender Eric Comrie, taking over from Zach Fucale, was solid as the Americans created some dangerous chances, despite being outshot 43-28 by Canada in the game. Winnipeg Jets prospect Comrie may have sealed the starting job with his performance.

The pre-game hype was all about Canada's Connor McDavid and the Americans' Jack Eichel, slated to go one-two in the NHL draft, but while both played well, neither dominated but each had an assist.

"It was exciting," McDavid said. "The U.S. has a great team. It was a lot of fun."

A quick pace was set early as the teams exchanged scoring chances at both ends in a first period in which Canada outshot the Americans 17-13.

But Canada took over in the second period, although it took until their 24th shot to beat Thatcher Demko. They did it with speed as Domi fired a puck on a rush and then banged in a pass off the rebound from Sam Reinhart at 7:07.

Canada's power play, which went into the game with a .500 success rate, struck at 10:11 as Morrissey drilled a shot inside the near post from the right circle after passes from Robby Fabbri and Nic Petan.

The Canadians conceded its first power-play goal of the tournament at 12:23 as a pass got through a maze of sticks in front for DeAngelo to fire into an open side.

McDavid blasted down the left wing and saw the rebound of his shot go in off Lazar, who skated hard into the crease, at 10:01 of the third period. The goal stood up to video review.

"I knew it was a good goal," Lazar said. "What a play by Connor. I just drove the net. They aren't going to be pretty all the time. It was the right call upstairs."