Captain Olga Carmona scored an 89th-minute winner to spark wild scenes of jubilation among their supporters at Eden Park.
Sweden – who have now lost back-to-back World Cup semi-finals – had equalised through Rebecka Blomqvist just 93 seconds earlier and it looked like the match would be going to extra time.
A game of few chances had sparked into life when substitute Salma Paralluelo, 19, gave Spain the lead with just 10 minutes remaining.
They will face England or hosts Australia in the final in Sydney on Sunday.
While Spain’s players celebrated wildly on the pitch at full-time, Sweden’s dropped to the floor as their World Cup dream came to an end.
There was little evidence of what was to come during a tight and cagey opening 80 minutes.
Spain boss Jorge Vilda opted to recall two-time Ballon d’Or winner Alexia Putellas, whose minutes on the pitch have been limited as she returns from a serious knee injury.
And it was Putellas who brought the biggest cheer of the opening half from the sell-out 43,217 crowd when she nutmegged Manchester City’s Filippa Angeldahl.
It took until the 42nd minute for the first shot on target, Sweden’s Fridolina Rolfo denied her third goal of the tournament by her Barcelona team-mate Cata Coll.
Spain dominated possession but Sweden’s defence, which has been solid and resolute for the past month, frustrated their opponents for long periods, while the Swedes once again used a familiar weapon to try and find a breakthrough.
Seven of their 11 goals at this tournament before the semi-final had come from set-pieces but Coll, who had not started a senior game for Spain prior to the World Cup, stood up well to Sweden’s inswinging corners, which had caused havoc in previous matches.
Then came the explosive finish.
Paralluelo, who scored the winner in the quarter-final against the Netherlands, kept her composure to fire Spain ahead before substitute Blomqvist poked home the equaliser.
With extra time looming, Carmona sent Spain through with a shot which went in off the bar following a corner.