Spain came from behind before eventually overcoming a dramatic scare to overcome Croatia in an eight-goal thriller after extra time at the Parken Stadium on Monday.
Luis Enrique's side were heading into the next round when Croatia bagged two late goals in seven minutes to level things up at the end of normal time, before strikes from Alvaro Morata and Mikel Oyarzabal settled the contest.
Despite La Roja's early dominance, it was Croatia who took a shock lead in the most fortunate of circumstances as goalkeeper Unai Simon allowed Pedri's back pass to squirm under his foot and in.
Luckily for the Spain No.1 his side were soon back level, as Pablo Sarabia smashed home an emphatic shot on the rebound after Jose Gaya's initial effort had been parried out.
Shortly after half-time the initial comeback was complete, as Ferran Torres centred from the left wing onto the head of Cesar Azpilicueta to divert past the goalkeeper.
The game then looked to have been put to bed in the 77th minute as Torres latched onto a long cross-field ball to skip round his marker and slide the ball into the bottom corner to increase the advantage.
But the drama wasn't over there.
Spain then had to weather a late surge from Croatia after Mislav Ortic managed to get the ball over the line amid a furious goalmouth scramble.
Then just as you thought Spain would close out the win, Orsic picked out Mario Pasalic for a late header to draw the match level and send the clash into extra-time.
Croatia came close to taking the lead but it was Morata who struck next, controlling Dani Olmo's cross before lashing it into the top corner to send Spain fans into raptures.
Any hopes of another comeback for Croatia were dashed when Olmo's cross picked out Oyarzabal for a fifth moments later, as Spain finally booked their place in the last eight.
Here are the talking points from Copenhagen.
1. Simple Simon
Oh dear, oh dear. Poor Unai Simon.
Spain were dominating, in control and completely at ease with their opponents, until bam! Out of nowhere, a mistake worthy of every football blooper DVD known to man - and in the knockouts of a major competition!
It was a routine pass back from Pedri in midfield, perhaps a little enthusiastic with a bit of spin on the ball, but nothing too troublesome.
The fact it was so routine was probably the issue for Simon, as he took his eye off the ball for just a second, and that's all that mattered, as it skipped over his foot and into the net.
He must have wanted the ground to swallow him up, and will no doubt still be rueing his error, though did make amends with a top save from Ante Budimir in extra time.
Where's the flawless David de Gea when you need him?...
2. Koke's miss
We can talk about Simon's howler till the cows come home - but let's not gloss over the fact Spain should have already been in front.
Midfielder Koke is not necessarily known for his goalscoring prowess, and it showed.
Pedri threaded a superb through ball into his teammate's path just 16 minutes in which was just begging to be slotted away.
Middle of the goal and one on one with 'keeper Dominik Livaković, a simple finish in either corner would have done the trick.
But Koke's composure crumbled as he hit his shot straight at Croatia's no.1.
As chances go, they don't come much better.
3. Best and worst of Morata
If Koke's miss was bad, Morata doesn't get off lightly for spurning his glorious opportunity.
A pinpoint cross from Torres was exactly where Spain's lead striker would have wanted it as he rose to head it home.
But Morata got it all wrong, heading it straight at the closest defender rather than into the huge gap left at the back post.
It's been a difficult tournament for Morata, who has bore the brunt of criticism from fans for his wastefulness in front of goal.
In this instance, he could hardly argue, but his overall performance was much better than he will perhaps get credit for, offering superb hold up play and bringing others into the game.
His disallowed goal for offside summed up his luck at the moment, but he soon had the last laugh as his splendid take down and half-volley helped send Spain into the next round.
4. Barcelona influence
It's true that Spain aren't the much-heralded team they used to be.
No longer do the likes of Xavi and Andres Iniesta run the show in midfield.
But that doesn't mean the Barcelona influence is dead and buried, as Sergio Busquets and Pedri proved with a masterclass against Real Madrid's Luka Modric and co.
Busquets was rolling back the years in the centre of the park, pulling the strings as Croatia struggled to get near him no matter how hard they pressed, picking passes at will, always one step ahead.
If the 32-year-old will soon be consigned to Spain's past, teenager Pedri is very much their future.
He was a constant thorn in Croatia's side all evening, buzzing around with attacking intent at every turn, drifting between the lines, driving forward purposefully and picking out some sublime passes.
Spain aren't the team of old, but if they are to go all the way in this tournament, it'll be another Barca pair who carry them.
5. Torres 2.0
Much like the classic Spain team of yesteryear, this latest edition has an impressive Torres in their ranks.
That this one is called Ferran and not Fernando is merely a minor detail.
The Manchester City forward was outstanding against Croatia, setting up Azpilicueta's winner with an inch-perfect cross, before getting on the scoresheet with a goal of his own.
Torres took a couple of games to get going in the tournament, but now looks to be firing on all cylinders, which can only bode well for his country.
6. Croatian spirit
They looked out for the count. Two goals behind with five minutes remaining.
But from somewhere, Croatia rallied to extend the match by a further 30 minutes and push Spain to their limit.
Orsic was the main protagonist, poking the ball over the line before whipping in a fine delivery for Pasalic to level the scoring.
He almost got another straight after the restart as his shot dipped just over the crossbar.
It was only for Simon's left hand that Croatia didn't get their noses in front again when Budimir was denied, before Spain struck the killer blows.
Croatia may not be heading through, but you can't say they didn't give it everything.