Spain will play for its first Women’s World Cup championship after Olga Carmona’s goal in the 89th minute lifted La Roja to a 2-1 victory over Sweden in the Tuesday semifinal.

Spain, which overcame last year’s near mutiny by its players against coach Jorge Vilda, will play the winner of tournament co-host Australia and England on Sunday in the final in Sydney.

The winner Sunday will be a first-time World Cup champion.

Sweden has now lost in four of five semifinals and will play for a fourth third-place finish.

Carmona’s goal capped a flurry of late scoring that saw Sweden tie the game, then Spain win it 90 seconds later on the surprise score.

Salma Paralluelo, the 19-year-old super-sub who also scored the game-winner in Spain’s 2-1 extra-time quarterfinals victory over the Netherlands, scored in the 81st minute to break a scoreless game. She gestured for the crowd, which thought it was celebrating Spain’s decider.

But the celebration was brief. Rebecca Blomqvist tied it for Sweden in the 88th.

Then just 90 seconds later, Carmona beat Sweden goalkeeper Zecira Musovic with the game-winner.

The Swedes have never won a World Cup, but they’ve come close: they were the 2003 runner-up and have finished third three times. Sweden won the silver medal at the Tokyo Olympics two years ago and at the 2016 Games in Brazil.

Spain is making only its third overall World Cup appearance. Four years ago, La Roja advanced to the knockout round but lost to eventual champions the United States.

The Swedes swept their opponents in the group stage before knocking out the United States, the two-time defending champions, on a penalty shootout after a scoreless draw. Sweden then got by Japan 2-1 in the quarterfinals.

Spain fell to second in its group to Japan before downing Switzerland 5-1 and the Netherlands 2-1 to reach the semifinals. It was La Roja’s first appearance in a major semifinal since the 1997 European Championships.

Spain’s two-time Ballon d’Or winner Alexia Putellas made her third start of the World Cup. Putellas ruptured her ACL last summer and has been working her way back to full fitness. She came off the bench in the team’s last two matches.

Putellas, who replaced Esther Gonzalez in the starting 11, was subbed off in the 57th minute for 19-year-old Paralluelo, who scored in extra time for Spain in the victory over the Netherlands.

Spain dominated possession and had the better chances in the first half. Defender Olga Carmona’s blast from the top of the box but the low shot went just wide. But Sweden’s defense, which had allowed just two goals in the tournament, held.

Putellas nutmegged Filippa Angeldal before delivering a cross in the 35th minute but Magdelena Eriksson was there to clear it away.

Spain goalkeeper Cata Coll dove to save Fridolina Rolfo’s shot late in the half, then punched the ball away on a corner kick to keep the game scoreless at the half.

Sweden had energy to start the second half but Spain still had chances. Paralleulo’s header in the 63rd minute sailed over the goal.

Alba Redondo was on the ground in front of the goal but got a foot on the ball and appeared to score in the 71st minute, but she was just wide and the ball was caught up in the side netting.

There were a few tense moments when Paralluelo’s goal was checked by video review, but the goal was awarded.

There were 43,217 fans on hand for the match at Auckland’s Eden Park.

That Spain made it this far was something of a surprise after a turbulent year. Last September 15 players wrote the federation saying they were stepping down from the national team to protect their mental health. The players called for a more professional environment.

Ultimately the Spanish federation backed coach Jorge Vilda. Three of the 15 players, including Bonmati, returned to the team for the World Cup.

Spain and Sweden had never met at the World Cup.