Leonard Pfoderl had the eventual second-period winner for Germany, and Matthias Plachta also scored.
"I thought we played a great game," Plachta said. "We made fewer mistakes today and didn't give them any free chances. Our goalie played unreal again today. We played as a unit and played hard."
Kristian Pospisil replied for Slovakia, which struggled offensively after downing France 4-2 in its opener.
"We play every game to win, and so does Germany," said Slovak defender Adam Janosik. "It was an intense game, but that's hockey. It was an important game, but there are still five more to go, so we have to look forward and pick our game up for next time."
Both teams entertain legitimate medal hopes at this tournament based on recent history. The Germans, who achieved an historic Olympic silver medal in 2018 in Korea, finished fourth at last year's tournament in Riga. Slovakia captured an out-of-the-blue bronze medal at the Beijing Olympics in February.
German netminder Philipp Grubauer had a strong bounceback performance after the 5-3 loss to defending champion Canada on Day One. The Seattle Kraken starter, who was honoured as Germany's player of the game, recorded 28 saves, while Slovakia's 2022 Olympic all-star Patrik Rybar had 14 stops.
"We weren't thinking about what happened yesterday," said Germany's Samuel Soramies. "We're always looking forward. We played a great defensive game. We didn't give them much. That was the difference."
The 18-year-old Slovak sensation Juraj Slafkovsky had two assists against France, but remains goalless through two games. Slafkovsky was named Olympic MVP in February after leading the tournament with seven goals.
The teams responded with intensity, working hard along the boards and going to the front of the net. Slovak blueliner Mario Grman landed the biggest bodycheck of the first five minutes, crumpling Daniel Schmolz at the German blue line.
During a seemingly endless scrum along the side boards in Slovakia's end, Simon Nemec was sent off for cross-checking Plachta from behind with just over two minutes left in the opening stanza. The Germans buzzed around, but couldn't convert with the man advantage.
Plachta drew first blood at 1:34, taking the puck coast to coast. With German captain Moritz Muller driving to the net, Plachta's attempted centering pass on the backhand deflected in off the hapless Janosik's skate.
"Timmy [Stutzle] just drove through and opened a lane for me," Plachta explained. "I was kind of surprised at first. I had a lot of room, and then Mo drove the net and I tried to hit him, but it hit the defenceman and went in. I'll take that kind of a lucky goal."
Germany jumped into a 2-0 lead at 6:41 with another goal off the rush. Pfoderl showed great smarts as he slid the puck across to Marcel Noebels, whose shot was stopped by Rybar. Pfoderl didn't give up on the play, shoveling a backhander into the wide-open net.
Grubauer came up huge just moments later, stopping Milos Roman when he busted in behind defenceman Korbinian Holzer for a clear shot on net.
Slovakia kept coming. At 11:15, Pospisil cut the deficit to 2-1. After failing to bang in a loose puck at Grubauer's right post, he showed great persistence, cashing in with a wraparound at the opposite post. The Slovak fans exploded with glee.
Yet Slovak jubilation quickly turned to indignation. Their team's poor discipline saw Germany enjoying a 5-on-3 man advantage for 1:25 with Daniel Gachulinec and Michal Ivan in the box. However, the Germans couldn't generate any serious chances.
In the third period, the Germans survived some early penalty problems, and then Grubauer held down the fort. The Slovaks yanked Rybar for a sixth skater with two minutes left, but the Germans held on by icing the puck or tying it up along the boards. It wasn't pretty, but the relentlessness was effective.
"Our game plan was to play hard and not allow them to come into our zone easily," Soramies said. "I think we did a great job of that."
Germany has now won its last four Worlds games versus Slovakia. The Slovaks last defeated Germany at the Worlds on 6 May 2013 in Helsinki by a 3-2 count.
In the last encounter between these two nations, Germany dealt Slovakia a heartbreaking blow with a 3-2 comeback win at the 2019 Worlds.
The host Slovaks led 2-1 with under two minutes to play. But Markus Eisenschmid scored the equalizer with 1:52 left with goalie Mathias Niederberger pulled for a sixth attacker, and Leon Draisaitl’s blast from his off wing with 27 seconds left proved to be the winner. Slovakia would miss the quarter-finals.
Next up on Monday, Slovakia battles defending champion Canada, while the Germans take on neighbouring France.