Slovakia took a 1-0 lead 8:42 into the first on a goal by Peter Cehlarik (Boston Bruins) but Germany scored the next five goals. Hager scored 4:23 into the second to tie the game, and Gogulla scored at 8:57 to give Germany its first lead. Reimer's power-play goal at 14:48 of the second made it 3-1.
Germany is fifth in Group B with four points; the top four teams advance to the quarterfinals. Germany last medaled at the World Championship in 1953 when it won silver. It hasn't advanced to the quarterfinals since 2011.
France 6, Hungary 2: Center Sacha Treille had a hat trick in a preliminary-round game in Group B at Yubileiny Arena in St. Petersburg.
Right wing Damien Fleury had a goal and an assist, left wing Pierre-Edouard Bellemare (Philadelphia Flyers) had three assists, and goaltender Cristobal Huet made 22 saves for France.
Defenseman Marton Vas had a goal and an assist for Hungary.
Norway 4, Kazakhstan 2:Right wing Mathis Olimb scored the go-ahead goal 18:17 into the second to lead Norway to in a preliminary-round game in Group A at Ice Palace in Moscow.
Left wing Mats Zuccarello (New York Rangers) scored into an empty net with 2:23 remaining in the third.
Lars Haugen made 17 saves for Norway.
Nigel Dawes had a goal and an assist for Kazakhstan.