Spain booked a quarter-final meeting with Women's Euro hosts England after a 1-0 win over Denmark ensured they finished as runners-up in Group B.
Having beaten Finland in their opening game, a draw was all Jorge Vilda's side needed to seal a place in the last eight behind group winners Germany but a late header from Marta Cardona put a gloss on their progression.
It was a cagey affair to begin with at a sunny and noisy Brentford Community Stadium, with 2017 runners-up Denmark threatening on the break 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 halftime.
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 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.
"We knew their game - they were just waiting for the moment to counter-attack, or get a corner to score a goal," Paredes said. "We knew that but had to trust in ourselves - just keep the ball and try, try, try, and defend. We suffered a lot but we trust in this team a lot and we won the game."
It is the third successive time Spain have qualified for the quarter-finals but they face a tough battle to reach the last four when they take on England at Brighton's Amex Stadium on Wednesday.
"To play in this country against them, with the atmosphere there’ll be in that game, is going to be amazing. It’s going to be a tough game but we are ready for that," Paredes added.
For Denmark it was a disappointing exit considering their strong showing in 2017 but captain and Chelsea forward Harder was proud of her team's showing on Saturday evening.
"I think the girls fought fabulously well, and I'm proud of them. We fought our backsides off, but the ball simply wouldn't go in," she told TV2.