CALGARY -- Switzerland was expecting a rebound game from Latvia on Friday night after suffering a humiliating 14-0 defeat to the Russians the night before.

But few imaged the late game push Latvia would bestow on Switzerland.

Trailing 3-1 heading into the third period, Latvia tied the game before Gaetan Haas and Christian Marti scored 59 seconds apart to lift Switzerland to a 5-3 victory at the Scotiabank Saddledome.

Making matters worse was the absence of standout forward Sven Bartschi due to concussion-like symptoms. In the end, it was no worry for Switzerland after Christoph Bertschy stepped into Bartschi's place, adding 2 goals in the victory.

"I think it was a lucky game for me tonight," Bertschy said. "The most important stat is that we won, and now I look forward to the game tomorrow."

Saturday brings Slovakia in a battle to determine which team advances to the quarterfinal.

"We already talked after the game in the dressing room what's going to be," Swiss coach Manuele Celio said. "We've got to keep up and try to be really ready for 4 o'clock tomorrow."

Victory almost didn't happen after the serious push late from Latvia.

Nikita Jevpalovs scored 2:23 into the third period to bring Latvia to within one. With just over seven minutes remaining, Vitalijs Hvorostinins put a rebound behind Switzerland starter Tim Wolf to tie the game.

Haas scored 24 seconds later to restore the lead with his second of the night. Marti added an insurance marker through a screen just under a minute later to extend the lead to 5-3.

With the Latvian goalie pulled, Switzerland shut down a 6-on-4 opportunity to preserve the victory.

"We brought them back in the game," Manuele said. "We didn't need to do that. We should have won easily. After 3-3, the guys stayed calm and put the puck on the net. I hope it's good learning for tomorrow."

Latvian coach Eriks Miluns was happy with the way his team responded after the Russian drubbing.

"It was our best game in the tournament," Miluns said through an interpreter. "After last night's loss our boys showed character. Luck was a little bit not on our side but I'm proud the way we battled and came back in the third. Hopefully we get the bounces soon."

Haas' first goal came midway through the second period after deflecting a Mike Vermeille point shot past Latvian starter Kristers Gudlevskis to put Switzerland up 2-0 midway through the second period.

But soon after, Haas coughed the puck up in front of Wolf. Toms Andersons picked up the puck, deked the Swiss netminder backhand and lifted the puck into the net to bring Latvia to within one at 8:26.

Bertschy restored the two-goal lead on the power play with just 1:32 remaining in the period. Floating in the high slot, Bertschy took a pass from Samuel Walser and fired a shot over the blocker of Gudlevskis -- his second of the night -- to make it 3-1 after 40 minutes.

Switzerland didn't have it in neutral coming out of the gates against Latvia, but had just a one-goal lead to show for their efforts after the opening 20 minutes at the Scotiabank Saddledome in Calgary.

On the power play, Dario Trutmann fired a shot that caught Gudlevskis' right pad. On the doorstep, Bertschy slid the rebound across the goal line to make it 1-0.

The goal came moments after Latvia almost opened the scoring on a shorthanded chance. Barreling down his off-wing, Hvorostinins sent a backhand on net that was met by the pad of Wolf. It was one of only three shots Wolf faced in the period.

While Switzerland will look to Slovakia, Latvia has the unenviable task of avoiding relegation for the second time in three years. They'll battle the loser of Switzerland and Slovakia, as well as Denmark and the United States.

"They're both going to be tough games," Miluns said. "All the teams will be battling to stay in the top division. Any team that's going to come from that side, it's going to be a hard game. The main opponent is going to be Denmark for us to stay in the top division."

Zemgus Girgensons agreed that if Latvia is to stave off relegation, it has to come at the expense of Denmark.

"We have to beat them to stay in the top division," he said. "It's our goal."

He's only 17 but he can see the ice so well and he moves the puck and goes to the open ice all the time, so I just think he's a player that is ready to play in the NHL. I'm really looking forward to coaching someone like this.

— U.S. National Junior Team coach Ron Wilson on Auston Matthews, the projected No. 1 pick of the 2016 NHL Draft