The crowd in St Petersburg saw Sweden take a two-goal lead after an hour, both coming from Emil Forsberg. A double from Robert Lewandowski got Poland back on terms but it was a stoppage-time winner from Viktor Claesson that sent them home.
With Spain beating Slovakia 5-0 in the other game, Sweden topped the group on seven points with the Spaniards in second on five. Slovakia had finished third on three but results in the other group games meant that they didn't have a good enough record to qualify for the knockout round.
Sweden go through to play Ukraine in the Last 16, on Tuesday 29 June in Glasgow's Hampden Park. Should they win that tie, they will go through to play one of Germany or England in the Quarter-Finals.
The results last night ended the group stages and also ended the tournament for Finland. Like Slovakia, their third-place record wasn't enough to see them sneak above Ukraine. Their goal difference lacking just one goal that could have changed things. Marcus Forss finishes Euro 2020 with two appearances from the bench, one in the opening game against Denmark and the other in their last match with Belgium.