Finland came into this match buoyed by their 9-1 thumping of Slovenia last time out, but after a positive start, they were on the backfoot for the rest of the first period.
Latvia led the shots on target count 12-3, but could not find a way past Juuse Saros, as Kaspars Daugavins was guilty of spurning a couple of their better opportunities.
Latvia were beaten 6-0 by Sweden in their previous outing despite no goals in the first 30 minutes, and they would have been nervous of a similar collapse when Finland broke the deadlock in the eighth minute of the second period.
Juuso Parssinen drove towards the right side of the net and attempted to cut the puck back to Patrik Puistola, who failed to make contact, only for the puck to deflect off Kristaps Zile's skate and into the net.
Temperatures began to boil over through the rest of period two, with nine two-minute penalties being dished out in just over 12 minutes. Amongst the fouls, a hockey game occasionally broke out, but it stayed 1-0 to the Finns after 40 minutes.
After neither side could take advantage of the powerplays in the second period, the first one in the third resulted in a goal.
Finland needed almost the whole two minutes to create the chance they needed in the Latvian zone, before captain Mikko Lehtonen stepped up with nine minutes remaining to make it 2-0.
However, the match was far from over, and Latvia denied Saros a shutout with a little under five minutes to play when Rudolfs Balcers set the puck back into the path of Rodrigo Abols, who drilled it into the top corner.
Pulling the goaltender and a powerplay in the final minutes gave Latvia every chance of forcing a late equaliser, but vital blocks and crucial stops from Juuso meant Finland held out for a narrow 2-1 victory.
The Leijonat have cemented themselves in third place, five points clear of the fifth-placed Latvians, who missed the chance to overtake Slovakia. Latvia face Slovakia tomorrow in what could be a straight shootout for fourth place, while Finland take on Canada on Monday.