TORONTO — The Czech Republic knew Wednesday night was a must-win situation in order to avoid relegation.

The team had a meeting prior to facing Russia at the world junior hockey championship and got the effort they've been looking for by defeating the Russians 4-1 to advance to the quarter-finals.

Patrik Zdrahal scored his first two goals of the tournament and David Pastrnak added three assists in the win.

The Czechs (2-2-0) will now face Slovakia in Friday's quarter-final while Russia (2-2-0) will travel to Montreal to play the United States.

"It's an unbelievable feeling because before the game, we were really low with our confidence because we didn't play good. Today we actually played like a different team," said Czech captain, Dominik Kubalik, a Los Angeles Kings' prospect. "We have a better team than (the way) we played before.

"I think we showed it today. We played hard. That's what we need."

The Czech Republic win also eliminated Switzerland.

Pavel Zacha and Onrej Kase had the other Czech Republic goals while Miroslav Svoboda made 16 saves in net.

Pastrnak, a 2014 first-round pick of the Boston Bruins, now has a goal and six assists in four games. Winnipeg Jets' prospect Jan Kostalek had two assists in the win.

"It was important. We were playing for second place in the group," said Pastrnak. "I think we started better. The first period we were much better. We had the game under control."

Ivan Barbashev replied for Russia with New York Rangers prospect Igor Shestyorkin making 22 saves.

Barbashev, a St. Louis Blues' draft pick, wasn't happy with his team's performance.

"I just think it was probably our worst game in this tournament," he said. "The game was brutal. It was just a brutal game for us, we didn't play well."

Zdrahal opened the scoring with his first of the tournament at 11:05 of the first period, one-timing a Pastrnak feed past Shestyorkin.

The Czechs took a 2-0 lead at 4:32 of the second when Zacha picked up a pass from Pastrnak and beat Shestyorkin blocker-side from the slot for his first of the world junior championship.

Zacha, 17, has nine goals and 19 points with the Sarnia Sting of the Ontario Hockey League this season.

"It's great for him cause he's a great goal scorer," said Kubalik. "He's got maybe the best shot on the team.

Russia had an excellent chance to get on the board at 11:31 of the second after being awarded a penalty shot. Barbashev was hauled down on a partial break in the Czech zone by Jan Scotka, however, Svoboda came up with a big right-pad save.

"It probably was a bad shot," said Barbashev of his attempt.

Barbashev redeemed himself just over four minutes later.

With Pastrnak off for hooking, Barbashev finished off a give-and-go with Vyacheslav Leshenko for his first of the tournament at 15:44 of the second period.

Zdrahal added his second of the night at 2:54 of the third period on a breakaway. Kase scored into an empty net with less than a minute remaining in the third.