Nokelainen beat goalie Viktor Fasth at 2:35 of the final period on a breakaway to give Finland a 2-1 lead and Niko Kapanen scored another 46 seconds later in the third.
Janne Pesonen, Mika Pyorala and Antti Pihlstrom scored in a 2:24 span later in the period to finish off the Swedes.
"Maybe the best period of the tournament," forward Tuomo Ruutu said. "That's how it's supposed to be. That's what you gotta do if you wanna win the gold medal."
It was the second world title for the Finns after they also beat Sweden in the 1995 finals.
"After a couple games, I saw we had a great chance to win," said Ruutu, who plays for the NHL's Carolina Hurricanes. "This is the biggest thing (in my career). It feels really good."
Sunday's game was the fourth worlds final between the long-standing rivals.
Sweden, which was chasing its ninth world title and first since 2006, won in 1992 and 1998.
Finnish goalie Petri Vehanen stopped 32 shots for the win.
"The third (period) was just by far not good enough against the strong team as Finland," Swedish captain Rickard Wallin said.
"We felt like we had a good chance (in the third) but a couple of mistakes early and they wrapped up two, and then just set back, waiting for our mistakes. They really didn't give us anything. We just didn't play close to good enough to be able to come back. We didn't have the best day today."
Jarkko Immonen started the Finnish comeback after he answered the opening goal by Magnus Paajarvi in the middle period to become the tournament's top scorer with nine goals.
"We had a great tournament," Finland coach Jukka Jalonen said. "We won the world championship because we were mentally very tough."
The victory is "great for the Finns as a nation, it's great for our ice hockey," Jalonen said.
"I'm proud of the Swedish guys, this is a start of something for us," Swedish coach Par Marts said.
Swedish goalie Viktor Fasth was selected the MVP of the tournament during the final period when he allowed five goals.
"It's important to see it in a long term and he's quite a goalie and had a really good tournament," Marts said.
In the bronze medal match earlier Sunday, Roman Cervenka had a hat trick to lead the Czech Republic to a 7-4 victory over Russia.
Petr Prucha scored twice and Jan Marek and Tomas Plekanec added one apiece for the Czechs — the defending champions — in a rematch of last year's final.
Ilya Kovalchuk finally found his scoring touch to score twice for Russia, but it was not enough. Dmitri Kulikov and Vladimir Tarasenko also scored a goal each.
The Czechs earned their fourth bronze at the worlds while Russia, the most successful nation in the worlds with 25 titles, finished without a medal for the first time since 2006.
"It's pity we didn't win the gold but you can't win every year," former NHL star Jaromir Jagr said.
The Czechs beat the Russians 2-1 in the final last year.
"To win the gold is perfect but who will care in a couple of years about the bronze," Jagr said. "But we had an excellent team here and played great hockey at the tournament."
The Czechs lost one game at the worlds, 5-2 in the semifinals to Sweden, and beat the Russians 2-1 at the group stage of the tournament.
"To beat the Russian team twice is a great achievement," Czech coach Alois Hadamczik said. "It's a great team."