Co-hosts Germany sealed the final place in the quarter-finals of the IIHF World Championship with a dramatic 4-3 shootout victory over Latvia in Cologne on Tuesday.
Frederik Tiffels was Germany's hero in his home city, scoring the decisive goal in the shootout four days before celebrating his 22nd birthday to dump Latvia out.
Latvia would have moved into the last eight at the expense of Germany with a win and came back from two down to lead 3-2, only for Felix Schutz to level things up again.
It was Tiffels who settled it, leaving Latvia distraught and ensuring Germany will face defending champions Canada at the same venue in the quarter-finals.
The United States beat Russia in a Group A decider, prevailing 5-3 prior to Germany's triumph at the LANXESS arena.
Anders Lee scored what proved to be the winner as the USA set up a clash with Finland in the last eight.
Finland ended the round-robin stage with a 5-2 loss against Canada, Mitch Marner claiming a double and laying on another goal.
Russia will now come against a Czech Republic side beaten 3-1 by Switzerland in their last Group B game. The Swiss will take on Sweden, who were 4-2 winners over Slovakia.
Belarus bowed out with a 4-3 triumph over Norway.