Team Canada is into the final four at the IIHF World Hockey Championship in Denmark.

On Thursday in Copenhagen, Canada defeated Russia 5-4 in overtime, as Ryan O’Reilly played the hero.

Canada had opened the scoring less than five minutes after the puck dropped in the quarterfinal matchup. With their power play coming to an end, defenceman Colton Parayko hammered home a slapshot from just inside the blue line for his third goal of the tournament.

Team Canada went up 2-0 midway through the second period on another power play goal, this one by Ryan Nugent-Hopkins. Connor McDavid looked like he was ready to shoot but instead crossed up the Russians by sending a nice cross-ice feed to his fellow Edmonton Oiler. However, the Russians quickly got back into the game when Ilya Mikheyev scored just a minute later to cut the lead to one. They tied it up with less than three minutes to play in the frame on a goal by Alexander Barabanov.

Canada reclaimed the lead seven minutes into the third period when the newest addition to the squad, Kyle Turris, snapped home his shot from the slot. That was his first goal of the world championship, having only joined Team Canada on Tuesday after his Nashville Predators were eliminated from the NHL playoffs.

But the Russians had a fast answer for that one too, as Sergei Andronov notched a goal of his own a minute and a half later.

With less than eight minutes to play, Pierre-Luc Dubois outmuscled a Russian defender to the net and put home a rebound, putting Canada up 4-3. But as had become apparent in this tight game, no lead was safe for Canada. Just two minutes later, Artyom Anisimov potted a backhand for the equalizer.

With no more goals in regulation, the game went to a 10-minute overtime. With 6:25 to play, the Russians took another penalty, as Kirill Kaprizov went to the box for slashing. Once again, the Canadians were able to take advantage of the man advantage. Standing just in front of the net, O’Reilly tipped in his fourth goal of the tournament on a nifty pass from McDavid, who had three assists in the game, for the winner.

Canada will play Switzerland in their semifinal on Saturday at 1:15 p.m. ET. Sweden and the United States will face off in the other semifinal at 9:15 a.m. ET. The medal matches will take place on Sunday.