"Overall it was an outstanding performance from the team, great attitude, great spirit, we had many chances, outstanding," Germany coach Joachim Low said after the game.
"We wanted better movement up front. From the start there was tempo, good combinations, from the wings with [Joshua] Kimmich and Gosens... That was our plan and it worked."
Germany got off to what appeared to be a dream start when Gosens scored from the near post after just five minutes.
However, a VAR review showed that Serge Gnabry had been offisde in the build-up and the goal was disallowed by referee Anthony Taylor.
It felt like it wasn't going to be Germany's day when Portugal scored 10 minutes later through record-breaking striker Ronaldo.
Portugal broke on a counterattack after a Germany corner with Jota excellently controlling the ball before crossing it to Ronaldo who tapped it past Manuel Neuer in goal.
Portugal's lucky tide began to turn after the half-hour mark, however, as they fell to two own goals within four minutes to see Germany take the lead.
The first came on 35 minutes when Gosens put a low hard cross into the box which Havertz and Dias both raced onto. Initially it looked like the Chelsea forward had got his foot to tap it into the net but replays showed the ball had come off Dias.
Germany added to their lead on 39 minutes after putting a number of crosses into the box. The ball was pinging around the penalty area with Havertz and Joshua Kimmich attempting to land it in the net. Guerreiro attempted to clear the ball but instead put it in his own net.
Havertz was able to get his name on the scoresheet officially in the second half after Gosens, who was everywhere for Germany, put a low cross into the box that Havertz tapped in.
Germany had the game wrapped up after an hour when Kimmich launched another corner into the box. Both Havertz and Gosens rose to meet it but it was the latter who got his head to the ball and put it past Rui Patricio.
Ronaldo repaid Jota for his earlier assist on 67 minutes. Portugal were awarded a free kick on the edge of the penalty box which was flicked on and looked like it was going to go wide.
However, Ronaldo managed to keep it in and flashed it across the face of goal where Jota was waiting to point it into the net.
"Anyone can progress. This group was always very strong," Santos said. "Whether we progress or not is still up to us. And we must respond to this."