Germany got off the mark in style at Euro 2020 as they tore Portugal apart with an impressive attacking performance in Munich to throw Group F wide open.
Germany's win means both these sides now sit on three points, one behind group leaders France, heading into a pivotal final round of fixtures on Wednesday.
Atalanta wing-back Robin Gosens was the architect with a goal and an assist, earning an ovation from the Allianz Arena crowd as he was replaced just after the hour mark.
Cristiano Ronaldo had put the visitors ahead, continuing his record-breaking campaign with his third goal of the tournament and 12th European Championship strike of all time.
But two own goals in the space of five first-half minutes flipped an entertaining encounter in Germany's favour, as first Ruben Dias and then Raphael Guerreiro turned into their own net.
The influential Gosens laid on a third immediately after the break with an inviting ball that allowed Kai Havertz to tap in from close range, before heading in Germany's fourth himself.
Diogo Jota poked in from Ronaldo's cutback but the defending champions were unable to mount a comeback.
Germany host Hungary, who earlier on Saturday held France to a draw, while Portugal face the world champions in the final game with all four nations still able to progress.
Germany find their rhythm
Germany boss Joachim Low told his side to be "more vigorous" in attack after their opening 1-0 defeat by France and saw that call answered as his side clicked into gear on home soil.
Gosens had already an effort disallowed for offside as Low's outfit took control before they were stunned by a ruthless Portugal counter attack from their own corner.
Die Mannschaft have not lost successive games in the group stage of a major tournament since defeats by England and Portugal at Euro 2000, when they finished bottom of the group, and two goals before half-time made sure that would not happen 21 years on.
First Portugal centre-back Dias turned Gosens' fizzed cross into his own net and moments later Guerreiro did the same as opposite wing-back Joshua Kimmich cut the ball back into a dangerous area.
There have been question marks over the deployment of Kimmich in that role, rather than in central midfield, but Low stuck with the team beaten by France and it was from wide that the Bayern Munich man and Gosens on the opposite flank caused problems.
Gosens set up Havertz for the third in another swift attack and then got on the end of a Kimmich cross to cap a superb performance.
This tournament will be the last of Low's 15-year reign in charge, with Germany keeping faith in the 61-year-old after his side failed to reach the knockout stage at the World Cup in 2018.
They did not look completely convincing in defence and had to hold out after Jota pulled a goal back, but are now well placed to reach the last 16.
Ronaldo chases records but Portugal outclassed
Portugal, who won this tournament five years ago having scraped out of the group stage in third place after three draws, face a nervy wait to progress once more after being outclassed on Saturday.
There was pre-tournament debate around whether the Selecao are a more cohesive side without Ronaldo, and midfielder Bruno Fernandes insisted before this fixture the side's fate will be decided by "us" and not individuals.
Inevitably it was Ronaldo who opened the scoring with Portugal's first shot - the 36-year-old sprinting from his own box after heading clear a Germany corner to put the finishing touches on a rapid break from Jota's smart pass.
The tap-in was Ronaldo's 107th international goal on his 177th appearance and moves the Juventus man within two of Iran's Ali Daei, whose 109 goals is a world record.
But Portugal, who have never won a game at the European Championship when trailing at half-time, found themselves behind before the break and Germany's attacking intent continued in the second half as the visitors became the first reigning champions to concede four goals in one match.
Ronaldo set up Jota for what proved a consolation with 23 minutes remaining and Renato Sanches then struck the post from outside the box.
But defeat means Portugal must now face France in the final group game knowing their future in the tournament remains uncertain.
What's next?
Portugal meet France in a rerun of the 2016 final, while Germany host Hungary in Munich, with both games kicking off at 20:00 BST on Wednesday.