Sweden scored in the first period thanks to Filip Forsberg with Latvia equalizing in the second courtesy of a Teodors Blugers goal.
The third period started with Sweden regaining the lead through Viktor Arvidsson, and within seconds it seemed Latvia might have equalised - but a replay showed the whistle was blown before the puck crossed the Swedish goal line.
Sweden then extended their lead thanks to Oliver Ekman-Larsson, leaving Latvia with just 13 minutes to turn the game on its head. However, the next few minutes saw continued pressure on the Latvian goal with few opportunities to get down the Swedish end of the rink.
But with just over 9 minutes remaining Rudolfs Balcers cut the deficit with a long-range effort, spurring the team towards a final push which saw them assault the Swedish goal twice in the final minute. But the champions held on to secure a 3:2 victory and Latvia finish the championship in a highly creditable 7th place.