Spain booked a quarterfinal clash with Women's Euro 2022 hosts England after their 1-0 win over Denmark on Saturday ensured they finished as runners-up in Group B.
Having beaten Finland in their opening game, a draw was all Spain needed to seal their place in the quarterfinals behind group winners Germany but a late header from winger Marta Cardona put a gloss on their progression.
It was a cagey affair to begin with at a sunny Brentford Community Stadium, with 2017 runners-up Denmark threatening on the counterattack but unable to find a clear shot on goal.
Spain had numerous efforts from forward Athenea Del Castillo but all were stopped by goalkeeper Lene Christensen, while captain Irene Paredes had a goalbound header cleared off the line on the stroke of half-time.
Spain dominated possession in the second half but their end product let them down, while Denmark's best chance fell to substitute Nadia Nadim in the 78th minute when she was set up by Pernille Harder in the box moments after coming on. However, her right-footed shot was tipped over by goalkeeper Sandra Panos.
Denmark looked out of ideas as the clock ticked down and their fate was sealed in the 90th minute as Cardona drifted in at the far post to get on the end of a deep cross from Olga Carmona and head in the winner.
It is the third successive time Spain have qualified for the quarterfinals and they will face a tough battle to go one better and reach the last four when they take on England at Brighton's Amex Stadium on Wednesday.