Germany beat Portugal 4-2 in their Group F match in Munich on Saturday.
Germany revived its Euro 2020 campaign with a 4-2 win against Portugal in Munich on Saturday. France's 1-1 draw with Hungary earlier in Budapest and Germany's victory means they have to play in the final group matches on Wednesday when the Germans host Hungary and the French face Portugal.
After Cristiano Ronaldo scored his 107th international goal, leaving behind Ali Daei's all-time record, giving Portugal a chance to lead, the Germans came back with four unanswered goals. German pressure forced goals from Ruben Dias and Raphael Guerreiro to put the home team 2-1 at half-time.
Germany continued to dominate Portugal, having won five consecutive World Cup or European Championship finals since Euro 2000.
Germany created the most chances compared to France's defeat on Tuesday, while Portugal were restless with their 3-0 win over Hungary on the same day.
The Germans had an unmarked goal five minutes later when the VAR saw Serge Gnabry's offside.
Gosens and Havertz defending the corner for Germany, Bernardo Silva began to attack, and then took Jota into the world-class pass.
It was Ronaldo's first goal to beat Germany to increase his record to 12th in the five European Championship finals.
However, two goals within four minutes turned the game around.
Germany rallied when another volos of Gosens flicked into the net by Havertz, Dias getting one last as the ball went past Rui Patricio on 35 minutes.
The second goal soon followed when Guerreiro turned Kimmich's cross into his own net as he tried to stop the ball heading forward in Germany.
German fans sang their hymns, with "Oh, it's so beautiful" (oh, that's beautiful) echoing the Allianz Arena.
Gosens was replaced shortly after his name was called.
Portugal put the goal back when Guerreiro's free-kick was scored by Ronaldo and turned in by Jota.
This is the first time Portugal have conceded four goals since a 4-0 defeat by Germany in the 2014 World Cup.