GANGNEUNG, Korea, Republic Of — Germany continued its miracle run at the Pyeongchang Olympics on Friday, booking an unlikely ticket to the gold-medal game after adding Team Canada to its upset list in a 4-3 semifinal win.

Canada pushed back hard in the third period, pulling two goals back but the Germans held on — just.

"It's as disappointing as it gets right there," said Canadian defenceman Mat Robinson. "A tough loss for us and we let our country down today. It's a tough pill to swallow."

"It's too little too late. We shot ourselves in the foot in the beginning of the game and we weren't able to come back from it," he added.

It was only Germany's second victory in 30 meetings with Canada in Olympic and world championship play. The first was a 5-1 win at the 1996 world championships.

The Canadian men had won the last 11 meetings, outscoring the Germans 58-15, and had gone 11-0-1 against the Germans since the 1996 loss.

Canada will play the Czech Republic for the bronze medal on Saturday while the Germans go for gold Sunday against the entry from Russia. The Russians blanked the Czech Republic 3-0 in the earlier semifinal.

Winnipeg-born Brooks Macek, Matthias Plachta, Frank Mauer and Patrick Hager scored for Germany, which led 1-0 after the first period and 4-1 after the second.

Robinson, Gilbert Brule and Derek Roy scored for Canada.

Robinson's goal, capping a two-on-one with a nifty backhand, cut the deficit to 4-2 at 2:42 of the third. Goaltender Kevin Poulin then did his part, stopping a Dominik Kahun penalty shot at 3:21 after a diving Cody Goloubef took down an onrushing German.

Roy made it 4-3 at 9:42 on the power play, sending a shot in from the side that hit a body in front and beat German goaltender Danny aus den Birken.

But the Germans, who toppled Switzerland Sweden to get to the semifinal, were full value for the win despite a third-period wobble. For the first 40 minutes, they were efficient, well-organized and opportunistic with two power-play goals. Canada was late coming to this party.

Canada outshot Germany 15-1 in third period and 31-15 for the game.

"The guys played hard in the third but that wasn't enough," said Canadian forward Maxim Lapierre. "We didn't start the way we wanted. We're definitely not happy with the end-result."

The Germans, who didn't even qualify for the last Olympics, won their only other Olympic hockey medal — a bronze — as West Germany in 1976. Canada, two-time defending champion, arrived in Pyeongchang with 15 men's hockey medals — nine gold, four silver and two bronze.

But with fewer than 10 Germans in the NHL, the absence of the NHLers has not hurt the Germans as much as most.

Canada won 2-1 the last time the two teams met, in the 2017 world championship quarterfinals. Only defenceman Chris Lee returns from that Canadian team, which was filled with NHLers. The Germans have 14 returnees.

Once again there were empty seats at the 10,000-capacity Gangneung Hockey Centre. Those Canadians who were there were silenced by a three-goal German outburst in the second.

Poulin got the start in goal for Canada with Ben Scrivens still nursing a shoulder injury that knocked him out of the 1-0 quarterfinal win over Finland. Poulin, who started the final preliminary-round game against South Korea, came into Friday's game having stopped all 34 shots he had faced at the tournament.

The Germans came as advertised, cool under pressure. But Felix Schutz lost the plot at 12:29 of the first period, dumping defenceman Maxim Noreau into the boards face first. Noreau got some facial repairs as coach Willie Desjardins argued unsuccessfully for more severe justice.

A Linden Vey high-sticking call negated the power play and Canada eventually found itself facing a five-on-three when it was called for delay of game on a faceoff violation. Macek made the Canadians pay with a wrist shot through Robinson and past Poulin's stick side from the faceoff circle at 14:43.

The 25-year-old Macek, who has dual citizenship through his German-born father, played junior for the Tri-City Americans and Calgary Hitmen. A sixth-round Detroit draft pick in 2010, he's played his club hockey in Germany since 2013.

It was a wide-open second period with three goals in less than five minutes.

Plachta made it 2-0 at 3:21 of the second period as Germany took advantage of a defensive miscue. Both Canadian defencemen were drawn to the onrushing Hager, who slipped a pass to an unmarked Matthias as Brule struggled to catch him. Hager beat Poulin with a high shot from in-close.

Germany scored again at 6:49 with a David Wolf stretch pass finding Marcel Goc. Digging Goc's pass out from between his legs, Mauer beat Poulin from in front.

Canada answered with a Brule one-timer from the faceoff circle on the power play at 8:17, off a feed from Chris Lee.

But Germany restored its three-goal advantage on the power play when a point shot bounced in off Hager's stick shaft at 12:31. Things went from bad to worse 28 seconds later when Brule was given a five-minute major and game misconduct for a check to the head that floored Wolf at centre ice.

On the plus side, Canada managed to kill off the major penalty.

Germany lost 5-2 to Finland and 1-0 to Sweden before edging Norway 2-1 in preliminary-round play. The Germans then upset Switzerland 2-1 in overtime in the playoff qualification round and Sweden 4-3 in overtime in the quarterfinals.

Going into the semifinal, Canada boasted the best power play in the tournament (38.5 per cent success rate) and the best goaltending (.956 save percentage after conceding just four goals in four games).

Canada sandwiched wins over Switzerland (5-1) and South Korea (4-0) around a 3-2 overtime loss to the Czechs in the preliminary round before dispatching Finland 1-0 in the quarterfinal.

The Germans are coached by 39-year-old Marco Sturm, who played 938 NHL games over 14 seasons with San Jose, Boston, Los Angeles, Washington, Vancouver and Florida.

All 25 Germans play in their national league, the DEL. Defenceman Christian Ehrhof and Goc played a combined 1,425 games in the NHL.

According to the International Ice Hockey Federation, there were 20,646 registered hockey players in Germany in 2017. The number in Canada was 631,295.

Follow @NeilMDavidson on Twitter