Robert Lewandowski netted a 49th minute penalty before Piotr Zielinski pounced on a Swedish error to make it 2-0 with 20 minutes to go in Chorzow.
Sweden had more shots 12-10 and more passes (445-281) and possession (62-38%) but it was Poland who finished the stronger.
“We had many problems before this match,” Bayern forward Lewandowski said.
“A lot of our players were injured, including me - I had a problem with my knee.
“We suffered, but now we can celebrate. I am proud and happy.”
Sweden, who made the 2018 World Cup quarter-finals, have missed out on qualification for the third time from the past four campaigns. Zlatan Ibrahimovic, 40, will likely not play another World Cup match.
Meanwhile, Manchester United’s Bruno Fernandes scored a brace as Portugal clinched its World Cup berth with a comfortable win over North Macedonia in Porto.
Cristiano Ronaldo laid off for Fernandes to open the scoring in the 32nd minute after an errant North Macedonia pass, while Diogo Jota got the assist for the United midfielder’s second in the 65th minute.
The victory means Portugal have made the past six World Cups, while it ends the dreams of North Macedonia, who knocked out Italy.
