The Swedes' victory snapped a nine-game winning streak that carried the unfancied Swiss all the way to their first final since 1935.
The Swedes were made to work hard in the beginning and fell behind in the fifth minute when tournament MVP Roman Josi cut across the ice before slotting a backhand shot between the legs of Swedish goalie Jhonas Enroth.
The Swedes then started to get to grips with the Swiss pressure and equalised through Erik Gustafsson, who fired home in the ninth minute to get the hosts back in the game.
The Swiss defensive discipline that was the bedrock of their semi-final victory against United States was sorely lacking in the final, as they racked up a total of 14 minutes in penalties in the first period.
Sweden's Henrik Sedin was on hand to punish that indiscipline when he flipped the puck into the net for a power play goal in the 12th minute to put his team ahead.
The second period was a stalemate with chances at a premium as both sides enjoyed periods of dominance.
The Swiss started the third period strongly and looked like getting back into the game, but when Julien Vauclair gave away the puck cheaply in his own zone, he left his side with a mountain to climb.
His miss allowed Gabriel Landeskog to streak in on goal and though his two efforts rebounded off Gerber, Simon Hjalmarsson made no mistake as he poked home the second rebound.
Switzerland put up a tenacious fight but despite exerting serious pressure, they could not fashion a goal, and when a shot from Sedin sailed past Gerber off the skate of Loui Eriksson, the game was all but over as a contest.
Sedin then took his tally for the tournament to four goals and five assists as he sent the puck sailing into an empty net with the Swedes short-handed.
With the clock counting down, the Swedes threw gloves and hockey sticks to fans behind the bench and the victory was greeted by an ear-splitting roar from the home support.
United States secured the bronze medal earlier in the day as they beat Finland 3-2 after a shootout.
Craig Smith and captain Paul Stastny had given the U.S. a first-period lead but Lauri Korpikoski fired in two goals in the middle of the final period for the Finns to force overtime.
In the end, Alex Galchenyuk converted two shootout penalties to give the Americans their first medal since 2004.