Spain beat Sweden in a thrilling finish to reach their first Women's World Cup final.
Captain Olga Carmona scored an 89th-minute winner to spark wild scenes of jubilation among their supporters at Eden Park, Auckland.
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 Australia in the final in Sydney on Sunday.
The semi-final between the Lionesses and the co-hosts is live across the BBC on Wednesday (11:00 BST).
Explosive finish after cagey 80 minutes
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.
Spain recover from squad turmoil
Spain had only won one of their previous seven Women's World Cup matches before this tournament. They now head for the final after their fifth - and most dramatic - win in New Zealand.
This historic win for Spain came just 15 days after they were beaten 4-0 by Japan in a group match.
Boss Vilda said after that defeat "no-one should lose hope" and his players have responded by eliminating Switzerland, the Netherlands and Sweden.
Spain had come into this tournament under a cloud after 15 players had threatened to quit the team as they were unhappy with Vilda's methods, and the coach initially exiled them from the squad.
Three of the 15 - Mariona Caldentey, Aitana Bonmati and former Manchester United defender Ona Batlle - were eventually included in his squad for the World Cup.
Spain appear to have put those differences to one side as all three players helped their country reach the final on a memorable night for La Roja.
'I hope Spain win'
It was the same old story for Sweden as they lost for the fourth time in five World Cup semi-finals, having knocked out 2015 and 2019 winners the United States and Japan in their past two matches.
Their players have been ruthless and efficient at this tournament but looked heartbroken after going so close to forcing extra time.
"There are so many emotions right now," said boss Peter Gerhardsson. "Everyone just feels sadness and huge disappointment."
Sweden now go to Brisbane for the third-place play-off on Saturday (09:00 BST).
"We will be really, really ready for that game," added Gerhardsson, who said he hoped that Spain would go on to win the World Cup.
Sweden's defeat means Caroline Seger, their long-term captain, will end her international career without a World Cup winners' medal after five tournaments.
Seger has been limited to just 69 minutes of action at this World Cup because of a calf injury.
Player of the match
BatlleOna Batlle
Spain
Squad number2Player nameBatlle
Squad number18Player nameParalluelo
Squad number19Player nameCarmona
Squad number6Player nameBonmatí
Squad number11Player namePutellas
Squad number8Player nameMariona Caldentey
Squad number17Player nameRedondo
Squad number3Player nameAbelleira
Squad number4Player nameParedes
Squad number10Player nameHermoso
Squad number14Player nameCodina
Squad number15Player nameNavarro
Squad number9Player nameGonzález
Squad number23Player nameCata Coll
Sweden
Squad number19Player nameRytting Kaneryd
Squad number16Player nameAngeldahl
Squad number18Player nameRolfö
Squad number15Player nameBlomqvist
Squad number11Player nameBlackstenius
Squad number6Player nameEriksson
Squad number8Player nameHurtig
Squad number13Player nameIlestedt
Squad number9Player nameAsllani
Squad number23Player nameRubensson
Squad number14Player nameBjörn
Squad number1Player nameMusovic
Squad number2Player nameAndersson
Squad number22Player nameSchough
Line-ups
Spain
Formation 4-3-3
23Coll Lluch
2Batlle4Paredes14Codina19Carmona
6Bonmatí3Abelleira11Putellas
17Redondo10Hermoso8Caldentey Oliver
23Coll Lluch2Batlle4Paredes14Codina19Carmona6Bonmatí3Abelleira11PutellasSubstituted forParallueloat 57'minutes17RedondoSubstituted forNavarroat 73'minutes10Hermoso8Caldentey OliverSubstituted forGonzálezat 90+5'minutesSubstitutes
1Rodríguez Rivero5Andrés7Guerrero9González13Salón15Navarro16Pérez18Paralluelo20Gálvez21Zornoza22del CastilloSweden
Formation 4-2-3-1
1Musovic
14Björn13Ilestedt6Eriksson2Andersson
16Angeldahl23Rubensson
19Rytting Kaneryd9Asllani18Rolfö
11Blackstenius
1Musovic14Björn13Ilestedt6Eriksson2Andersson16Angeldahl23RubenssonSubstituted forHurtigat 87'minutes19Rytting KanerydSubstituted forSchoughat 77'minutes9Asllani18Rolfö11BlacksteniusSubstituted forBlomqvistat 77'minutesSubstitutes
3Sembrant4Lennartsson5Sandberg7Janogy8Hurtig10Jakobsson12Falk15Blomqvist17Seger20Bennison21Enblom22SchoughReferee:Edina Alves BatistaAttendance:43,217Live Text
Match ends, Spain 2, Sweden 1.
Second Half ends, Spain 2, Sweden 1.
Olga Carmona (Spain) wins a free kick in the defensive half.
Foul by Lina Hurtig (Sweden).
Eva Navarro (Spain) wins a free kick in the attacking half.
Foul by Nathalie Björn (Sweden).
Substitution, Spain. Esther González replaces Mariona Caldentey.
Irene Paredes (Spain) wins a free kick in the defensive half.
Foul by Magdalena Eriksson (Sweden).
Foul by Teresa Abelleira (Spain).
Lina Hurtig (Sweden) wins a free kick in the attacking half.
Goal! Spain 2, Sweden 1. Olga Carmona (Spain) left footed shot from the left side of the box to the high centre of the goal. Assisted by Teresa Abelleira following a corner.
Corner, Spain. Conceded by Nathalie Björn.
Goal! Spain 1, Sweden 1. Rebecka Blomqvist (Sweden) right footed shot from the centre of the box to the bottom right corner. Assisted by Lina Hurtig with a headed pass.
Delay over. They are ready to continue.
Substitution, Sweden. Lina Hurtig replaces Elin Rubensson.
Delay in match because of an injury Cata Coll (Spain).
Attempt missed. Magdalena Eriksson (Sweden) header from the centre of the box misses to the right. Assisted by Elin Rubensson following a set piece situation.
Foul by Laia Codina (Spain).
Rebecka Blomqvist (Sweden) wins a free kick in the attacking half.