Sweden winger Emil Forsberg scored a double including the second fastest strike in European Championship history before Viktor Claesson's stoppage-time goal helped the side seal a 3-2 win over Sweden on Wednesday and top Group E heading into the last-16.
Sweden will next face one of the third-placed sides from Groups B, C or D - Finland, Ukraine or the Czech Republic - in Glasgow on June 29.
Spain, which finished second following its 5-0 win over Slovakia in the other Group E match, faces Croatia in Copenhagen a day earlier.
It was a heartbreaking end to Poland's campaign after the team twice drew level through talismanic skipper Robert Lewandowski, whose 84th minute equaliser for 2-2 gave the side a glimmer of hope.
Sweden's previous two matches were built on robust defensive displays that had cast doubts on whether Janne Andersson's side could get its attack firing, but the team made a blistering start through the lively Forsberg.
After Robin Quaison controlled the ball on the edge of the penalty area, Forsberg collected a pass and took advantage of some poor defending to fire past goalkeeper Wojciech Szczesny with 82 seconds on the clock.
He doubled their lead with a powerful drive for his third goal of the tournament after substitute Dejan Kulusevski weaved his way into the box to lay it on a platter in the 59th minute.
Lewandowski pulled a goal back two minutes later with a curling shot before Jakub Swierczok's tap-in from substitute Przemyslaw Frankowski's pass was ruled out for offside after the Video Assiatant Referee's intervention.
Lewandowski, who missed chances to make it 1-1 in the first half after rising above Sweden's defence only to thunder two headers onto the crossbar, fired in the equaliser from close range after a pass from Frankowski.
But Sweden was not done yet, as Kulusevski slipped the ball to Claesson who slotted past Szczesny to secure the win.
"It was a rollercoaster emotionally. It was 2-0 and as calm as it could be, then they got back into the game and got two goals," Claesson told Sweden's TV4.
"From 2-1, there's always pressure there. It's hard to do anything but defend in those situations when they have that kind of momentum. We'll hopefully get a slightly easier opponent in the last 16."
Latest on Sportstar
- Heat vs Nuggets Live Score, Game 2: MIA 32-44 DEN; Denver storms ahead in second quarter - NBA Finals updates
- Denver Nuggets vs Miami Heat LIVE Streaming Info: When and where to watch the NBA Finals Game 2?
- Sabalenka makes French Open last eight for first time
- Tsitsipas blasts past Ofner to make French Open quarter-finals
- Duplantis sets new 2023 pole vault best