Salma Paralluelo scored deep in extra time to give Spain a 2-1 win over Netherlands on Friday and send the sixth-ranked nation into the semifinals of the Women's World Cup for the first time.
The teenager struck late of a tight clash between European heavyweights whose men's teams already have storied World Cup histories.
Netherlands lost the final to the United States in France four years ago, and now both teams have exited the tournament.
The 19-year-old Paralluelo made her break down the left, pivoted momentarily and from a difficult angle launched a left-foot shot into the back of the net for the winner.
Netherlands defender Stefanie van der Gragt had turned from villain to hero in the last 10 minutes of regular time. She conceded a penalty for hand ball in the 81st minute which Mariona Caldentey converted to give Spain a 1-0 lead. Then, right at the start of stoppage time, she timed a run brilliantly from Victoria Pelova's through ball and added a polished finish to level the scores.
One on one with Spain keeper Cata Coll, she fired her shot precisely into the left side of the net.
This was always going to be van der Gragt's last global tournament before retirement.
At first it appeared likely her career would end on a cruel note, when a cross hit her outstretched right arm as she patrolled the edge of the area. After a VAR review, Spain was awarded the penalty.
Caldentey placed the ball on the spot, took a few steps back in a hushed stadium, paused, shuffled then sent keeper Daphne Van Domselaar the wrong way with her low shot into the left corner.
Then van der Gragt equalized to send the match into extra time.
It was Beerensteyn who went closest in the second period of extra time. Apparently tireless, she broke away but sent her shot across goal.
Just over 32,000 watched the match, including New Zealand Prime Minister Chris Hipikins and FIFA president Gianni Infantino on a sunny but cold afternoon in New Zealand's capital. Fresh snow fell overnight on the peaks of the Orongorongo ranges which stood out against the blue sky across the harbor from Sky Stadium. A 5.6 magnitude earthquake rattled Wellington an hour before kickoff.
Spain had much the better of a scoreless first half and seemed to have taken the lead in the 37th minute when Esther Gonzalez drove home Alba Redondo's cross from close range. But a VAR review showed Gonzalez had just crept offside.
There were other chances. Redondo hit the post twice in the 17th minute when her header was partially deflected by the Dutch keeper, then again from the rebound.
Redondo and Gonzalez were constant threats but the finishing touch just eluded Spain. Spain also knitted tightly and completed 259 passes to the Netherlands' 182. Aitana Bonmati always had a creative hand to play for Spain.
Netherlands pressed and sent long balls forward in search of Beerensteyn. They finally connected in the 28th minute and Beerensteyn dragged the ball back for Esmee Brugts, who crossed and came within a fraction of finding Damaris Egurolla in front of goal.
Lieke Martens, who had been so effective for Netherlands in previous matches, wasn't able to get into the match in the first half.
There were other moments in the first half, mostly Spain's but the deadlock remained. The crowd seemed oddly uninvolved, perhaps pensive, brought to their feet only by Gonzalez thwarted effort.
Gonzalez again went close to start the second half, striking a shot from 20 meters just wide of the post.
Netherlands was thwarted by the VAR in the 62nd when Irene Paredes received a yellow card after a tussle with Beerensteyn in the area. But the video review canceled the penalty along with the yellow card.
Paredes along with Alexia Putellas, who started on the bench, has played in all 12 of Spain's World Cup matches since 2015.
The Netherlands have been the biggest travelers at this World Cup. Based at Tauranga in New Zealand's North Island, they played in Wellington, then in Dunedin on the South Island, traveled to Australia for the round of 16 and back to Wellington for Friday's quarterfinal.
Now they have one more trip — home.