Filip Forsberg of the NHL's Nashville Predators scored the winning penalty as Sweden came back from 1-0 down in the shoot-out to win 2-1 following a 2-2 draw after overtime.
Surprise finalists Switzerland had been aiming for their first ever world title, while Sweden claimed an 11th crown.
Sweden had been the only unbeaten team through the group stage while Switzerland scraped into the quarter-finals with the weakest record.
But they stunned Group B winners Finland and then Canada to take their place in a third world championship final.
Five years ago they had lost to Sweden, who beat them 5-3 in the group stages too.
Switzerland twice took the lead, in each of the first two periods, but were pegged back by the favourites before the end of each stanza.
Minnesota Wild's Nino Niederreiter had given them a 16th minute lead but Gustav Nyquist of the Detroit Red Wings equalised a minute later.
On 23 minutes Timo Meier of the San Jose Sharks put the underdogs in front again, but that was wiped out by New York Ranger Mika Zibanejad on 34 minutes.
With no scores in either the third period or overtime, the final was decided by a shoot-out where Switzerland once again took the lead.
But Oliver Ekman-Larsson cancelled out Sven Andrighetto's successful strike, allowing Forsberg to become the hero.
Christopher Kreider of the Rangers scored twice as the United States thumped Canada 4-1 to take the bronze medal.
After Kreider opened the scoring, Marc-Edouard Vlasic of the Sharks equalised.
But goals from Nashville's Nicholas Bonino and Anders Lee of the New York Islanders put the US in charge before Kreider rounded out the win.