The Scandinavians were three-time consecutive silver medallists at the Games, finishing second at Barcelona, Atlanta and Sydney, but now they aim to go one better when they face either France or Croatia in two days' time.
The victory was underpinned by fast breaks in attack and a solid defence, with Niklas Ekberg taking himself to the top of the scoring chart for the tournament with six goals.
It was a valiant effort from Hungary, who will at least equal their best-ever Olympic finish of fourth, but they could take bronze for the first time in their clash with the loser of tonight's second semi-final.
Both sides came into the match on the back of superb results in the quarter-finals, with Hungary emerging triumphant over pre-tournament favourites Iceland after two periods of extra time, while Sweden saw off European champions Denmark.
It was an even start as both sides traded goals throughout the opening 17 minutes for the score to be tied at 7-7, with Hungary goalkeeper Roland Mikler enjoying himself, saving five of the first nine shots thrown at him.
But Sweden soon found their accuracy in front of goal and a strong final 13 minutes saw them throw in two separate three-goal salvos, which was enough to give them a 15-12 lead at the break.
Ekberg was again the main player for the Scandinavians as he threw in four first-half goals to take his tally to 42 for the tournament and he continued his hot streak in the opening exchanges of the second period, with two more as the advantage was extended to 21-17.
If Hungary were feeling the effects of a gruelling 80 minutes of action against Iceland just 48 hours earlier, they were not showing it as they threw three successive goals in to bring their deficit back down to one.
Sweden held firm and did enough to restore that cushion to three goals going into the final 10 minutes, but Hungary kept going, backed by a sizeable and vocal following, and brought the score back to 25-26 with 90 seconds to go as a grandstand finish was on the cards.
Kim Ekdahl du Rietz effectively won the game for Sweden when he threw in with 22 seconds remaining to give them a two-goal lead, which did not leave enough time for Hungary to turn it around, though they did add one more.
There were contrasting scenes at the end of the epic encounter, with Sweden jubilant and Hungary inconsolable as the Scandinavians advance to the gold-medal match.
France remain on course to become the first team to ever defend their Olympic title in the men's handball competition after a comfortable semi-final 25-22 victory over Croatia at the Basketball Arena.
Les Bleus, cheered on by an army of supporters who have made the short trip across the English channel, are now just 60 minutes away from history after setting up a final with Sweden on Sunday.
The victory was inspired by a strong second-half performance, at one point giving themselves a five-goal advantage, with Daniel Narcisse and Luc Abalo scoring four goals apiece.
Croatia were the only team with a 100 per cent record in the competition coming into the game, but their hopes of becoming the first team to win three gold medals in the men's competition are over and they will now contest the bronze medal with Hungary in a prelude to Sunday's final.
France were in the ascendancy from the off and raced into a 3-0 lead after five minutes, but their real hero was at the other end as goalkeeper Thierry Omeyer saved eight out of the first nine shots thrown at him, which allowed that advantage to stretch to 5-1.
But any hopes that a partisan French crowd had of their team running away with it were quickly dashed by a superb response from Croatia, which was almost single-handedly inspired by Zlatko Horvat, who threw in five goals as the the deficit was reduced to 10-9.
France enjoyed a strong final three minutes of the first half, though, and went into the half-time interval 12-10 up.
And they carried that form into the opening exchanges of the second period, putting one foot into the final as four straight goals put them 18-13 ahead with 43 minutes on the clock.
Croatia threatened a comeback when they got back to 19-17, but they came up against an in-form Omeyer who continued to make save after save, which allowed France to remain in control.
Claude Onesta's side advanced comfortably to the final hooter, sealing a three-goal winning margin to set up their date with destimy in two days' time.