HERNING, Denmark -- Connor McDavid scored in overtime as Canada edged Latvia 2-1 Monday at the world hockey championship.

McDavid batted his own rebound out of the air past Latvia goaltender Kristers Gudlevskis for the winning goal.

Anthony Beauvillier also scored for Canada, while Kristians Rubins scored for Latvia.

Canada clinched a quarter-final spot and moved into third place in Group B with 12 points on three regulation wins, one overtime win, a regulation loss and a shootout loss.

Canada's final preliminary-round game is Tuesday against Germany.