Portugal led 1-0 going into the second leg and dominated before Ronaldo’s angled drive deservedly put them ahead.
Zlatan Ibrahimovic levelled on the night with a free header before he lashed in a free-kick as the hosts sensed an unlikely comeback in the tie.
But two quickfire goals from Ronaldo secured Portugal’s place in Brazil.
The two-legged tie was billed by many as a battle between Ronaldo and Swedish counterpart Ibrahimovic for the right to showcase their supreme talents on the greatest stage of all next summer.
And the pair failed to disappoint as they became the central figures in a remarkable second half in Stockholm, where all five goals were scored in a 29-minute burst.
Sweden knew they needed to employ a more attack-minded gameplan on home turf after Ronaldo headed in a late winner in Friday’s first leg in Lisbon.
But they barely threatened in a first-half performance which lacked quality and any notable opportunities for them to wipe out Portugal’s slender advantage.
Erik Hamren’s side did start briskly, with Martin Olsson and Alex Kacaniklic combining well down the left on several occasions.
However, they lacked a penetrative final ball and Portugal managed to ride out the pressure before gradually growing in the game, led by Ronaldo.
After defender Bruno Alves’s downward header forced Sweden goalkeeper Andreas Isaksson into a save low to his right, the ex-Manchester United player took control of the match and orchestrated every attacking move by the visitors.
He was unable to convert a trio of difficult chances, before he turned provider with a deep cross that Hugo Almeida could only head into the side-netting with the Sweden goal gaping.
Ibrahimovic was a peripheral figure for the Swedes in Lisbon, and was almost as anonymous in the first half on Tuesday.
The Paris St-Germain striker continually dropped deep to receive the ball before half-time, but found more attacking purpose in the early stages of the second half as he pushed further forward.
And his tenacious run into the Portuguese box almost instantly paid dividends. The Swedish talisman stretched to scoop the ball back from the byline to team-mate Seb Larsson who could only poke straight at Portugal goalkeeper Rui Patricio.
Within 90 seconds, Ronaldo silenced the noisy Friends Arena by latching on to Joao Moutinho’s perfect throughball and smashing in an angled drive.
The opener meant Sweden needed to score three times to turn the tie around, but they were given hope when Ibrahimovic nodded in Kim Kallstrom’s right-wing corner after marker Alves barely jumped to challenge.
The partisan Swedish crowd – perhaps taking heart from their team’s remarkable comeback from a 4-0 deficit to draw against Group C rivals Germany in October 2012 - rediscovered their voices again when Ibrahimovic thumped in a free-kick on the edge of the Portugal area.
But their hopes were quickly dashed as Ronaldo stole the show at Ibrahimovic’s expense.
The 28-year-old produced two more strikes of the highest quality – which even appeared to draw applause from the Sweden skipper.
Ronaldo first latched on to Almeida’s throughball to fire beyond Isaksson before rounding the Sweden goalkeeper and blasting in – to spark wild celebrations from the Portuguese camp.
Portugal captain Cristiano Ronaldo:
“I know Portugal needed me in these matches and I showed I am here. I just did my work as I have been doing lately.”
Sweden captain Zlatan Ibrahimovic:
“One thing is sure, a World Cup without me is something I won’t be following. All my congratulations to Portugal, but the two teams deserved to go to the World Cup.”