Cristiano Ronaldo had put holder Portugal ahead early on with a strike that took him level with Miroslav Klose as the European player to have scored the most combined goals (19) across the FIFA World Cup and European championship.
Joachim Low's side stormed back before half-time, however, courtesy of two own goals in the space of four minutes from Ruben Dias and Raphael Guerreiro.
The 2014 world champion wrapped up an emphatic first victory of the tournament in the second half thanks to strikes from Kai Havertz and the impressive Robin Gosens, with Diogo Jota pulling one back for Fernando Santos's men.
Left-back Gosens thought he had handed Germany a fifth-minute lead but his acrobatic effort at the back post was ruled out for offside against Serge Gnabry.
Despite Germany's dominant start it was Portugal that struck first, Ronaldo tapping home from close range in the 15th minute after a flowing counter-attack involving Bernardo Silva and Jota.
Germany pulled level 10 minutes before half-time, though, when Dias diverted Gosens's mis-hit volley past Rui Patricio from just outside the six-yard box.
Things got even better for Joachim Low's side four minutes later when Guerreiro turned into his own net from close range after Joshua Kimmich had pulled the ball back across the face of goal.
The lead extended further six minutes after the interval, Havertz turning in Gosens's cross from close range.
Gosens then added his name to the scoresheet on the hour mark, leaping highest at the back post to head home Kimmich's cross from the right.
Liverpool striker Jota gave Portugal hope of pulling off a memorable comeback when he fired home from Ronaldo's pull-back in the 67th minute, but Germany held on to inflict just a third defeat in its past 31 matches for Portugal. which hit the post late on through Renato Sanches.