Yannic Seidenberg — the younger brother of New York Islanders defenceman Dennis — put one past Swiss goalie Jonas Hiller 26 seconds into overtime, securing the 2-1 victory.
That capped what had been a closely contested but chippy match between the two European neighbours. The Germans opened the scoring less than two minutes into the game with a goal from Leonhard Pfoederl that came on a four-minute power play after Canadian-born Cody Almond was ejected from the game for a check to the head.
Germany maintained its lead until the second, when the Swiss responded four minutes in with a tap-in by Simon Moser to tie it up.
That score would hold all the way until overtime, when Germany ended it quick. Seidenberg broke free of his man and tapped in a rebound.
"I didn't see the puck at first," Hiller said, "so I just went down and they hit me somewhere and then I couldn't find it."
Seidenberg said in four-on-four overtime, goals often come on broken plays when "you get a bounce," he said after the game.
"It's what happened and I am the happy guy — or lucky guy — that had the bounce and I am so proud I put it in."
Shots were 23-20 in favour of the Swiss, but it's the Germans moving on.
The Germans will now face Sweden in the quarterfinals. Sweden was the lone undefeated team in the tourney, going a perfect 3-0, but Pfoederl said the defensively minded Germans have a shot.
"We believe we can win," he said after the game. "We'll try hard and we'll see what happens."
The winner of that match will face off against the winner of another quarterfinal between Canada and the Finns in the semis.
It's Germany's first appearance in the quarterfinals since 2002. The country's best ever performance at the Games was a 5th-place finish in 1976.