Spain reached the quarter-finals of Euro 2020 in dramatic fashion by beating Croatia in extra time after an eight-goal thriller.
Luis Enrique's side were rocked when Croatia substitutes Mislav Orsic and Mario Pasalic scored twice in the final five minutes to come back from 3-1 down and force extra time, but Spain rallied as the added 30 minutes produced yet more drama.
Striker Alvaro Morata, who revealed before the match that his family have been threatened during the tournament as a result of his performances, silenced his critics when he thumped in Spain's fourth goal in extra time in Copenhagen.
The scoring did not end there as Mikel Oyarzabal added a fifth goal three minutes later to finally see off Croatia, who had fought bravely in this highly entertaining last-16 tie.
In a hint of what was to come, 20 minutes into the game goalkeeper Unai Simon failed to control Pedri's 49-yard back pass, presenting Croatia with the lead.
That bizarre own goal sparked a response from Spain though, with Pablo Sarabia thumping in an equaliser, Cesar Azpilicueta heading in another and Ferran Torres making it 3-1.
Spain looked comfortable and poised to cruise through but Croatia burst into action through their substitutes late on to force added time.
The thrilling moments continued as Simon made up for his earlier error with a heroic stop from close range to deny Andrej Kramaric before Morata went up the other end to crucially put Spain ahead again.
It was the most entertaining match of the tournament so far and three-time champions Spain will face the winner of France and Switzerland (kick-off 20:00 BST) in the quarter-finals.
Morata and Simon display Spanish character
Spain became the first side in European Championship history to score five or more goals in consecutive matches - but Morata's was the most important.
The forward had missed several good chances in the tournament before this game and it looked like it would not be his night again when he failed to nod in Ferran Torres' cross early on.
Two minutes later, that miss looked especially costly as Croatia took the lead - but it was Morata who the Spain players gathered to congratulate at full-time after their place in the quarter-finals was sealed thanks largely to his goal.
Spain's credentials to go deep into the tournament have been enhanced by this display of character to initially bounce back from the own goal then re-gather themselves after Croatia had forced extra time.
The scenes at full-time were a mixture of jubilance and relief even if their biggest test may come next, with world champions France their potential quarter-final opponent.
There was nobody more relieved than keeper Simon too - he pulled off a crucial save in extra time after his huge error.
Croatia bow out - but not without fight
World Cup finalists Croatia lost at the last-16 stage for the second Euros in a row after they were beaten by eventual winners Portugal in 2016.
But they did not leave without a fight.
Spain were relentless for periods of the match but Croatia created a number of clear-cut chances and had they been more clinical, it could have been a different story.
Nikola Vlasic smashed one into the side-netting and Kramaric was flagged offside as he snuck in behind before Spain went 3-1 up.
But just as Spain looked at ease, Croatia upped the intensity, unwilling to leave the competition without making an impact.
The substitutes forced extra time and Croatia could have gone ahead when Orsic fired dangerously over the bar minutes before Kramaric was denied by Simon.
Those misses proved costly and Spain almost scored a sixth when Dani Olmo's curler smacked off the left post in the dying moments.
Croatia were naturally dejected at full time after they could not muster another astonishing comeback - but they had left their mark on this tournament by playing their part in an epic match.
Player of the match
AzpilicuetaCésar Azpilicueta
Line-ups
Croatia
Formation 4-3-3
1Livakovic
22Juranovic21Vida5Caleta-Car25Gvardiol
10Modric11Brozovic8Kovacic
13Vlasic20Petkovic17Rebic
1Livakovic22JuranovicSubstituted forBrekaloat 74'minutes21Vida5Caleta-CarBooked at 83mins25Gvardiol10ModricSubstituted forIvanusecat 114'minutes11BrozovicBooked at 73mins8KovacicSubstituted forBudimirat 79'minutes13VlasicSubstituted forPasalicat 79'minutes20PetkovicSubstituted forKramaricat 45'minutes17RebicSubstituted forOrsicat 67'minutesSubstitutes
2Vrsaljko7Brekalo9Kramaric12L Kalinic14Budimir15Pasalic16Skoric18Orsic19Badelj23Sluga24Bradaric26IvanusecSpain
Formation 4-3-3
23Simón
2Azpilicueta12García24Laporte14Gayà
8Koke5Busquets26González
11Torres7Morata22Sarabia
23Simón2Azpilicueta12GarcíaSubstituted forTorresat 72'minutes24Laporte14GayàSubstituted forAlbaat 78'minutes8KokeSubstituted forRuizat 78'minutes5BusquetsSubstituted forRodriat 102'minutes26González11TorresSubstituted forOyarzabalat 88'minutes7Morata22SarabiaSubstituted forOlmoat 72'minutesSubstitutes
1de Gea3Llorente4Torres6Llorente9Moreno10Thiago Alcántara13Sánchez16Rodri17Ruiz18Alba19Olmo21OyarzabalReferee:Cüneyt ÇakirAttendance:22,771Live Text
Match ends, Croatia 3, Spain 5.
Second Half Extra Time ends, Croatia 3, Spain 5.
Offside, Spain. Rodri tries a through ball, but Álvaro Morata is caught offside.
Attempt missed. Fabián Ruiz (Spain) right footed shot from the left side of the box is close, but misses to the right. Assisted by Álvaro Morata.
Attempt blocked. Mikel Oyarzabal (Spain) left footed shot from the centre of the box is blocked.
Dani Olmo (Spain) hits the left post with a left footed shot from the centre of the box. Assisted by Mikel Oyarzabal.
Mikel Oyarzabal (Spain) wins a free kick on the right wing.
Foul by Duje Caleta-Car (Croatia).
Corner, Spain. Conceded by Dominik Livakovic.
Attempt saved. Álvaro Morata (Spain) left footed shot from the left side of the box is saved in the bottom left corner. Assisted by Unai Simón.
Substitution, Croatia. Luka Ivanusec replaces Luka Modric.
Hand ball by Domagoj Vida (Croatia).
Álvaro Morata (Spain) wins a free kick in the defensive half.
Foul by Domagoj Vida (Croatia).
Corner, Croatia. Conceded by Pau Torres.
Attempt missed. Ante Budimir (Croatia) left footed shot from the centre of the box is close, but misses to the right. Assisted by Mario Pasalic with a through ball.
Second Half Extra Time begins Croatia 3, Spain 5.
First Half Extra Time ends, Croatia 3, Spain 5.
Goal! Croatia 3, Spain 5. Mikel Oyarzabal (Spain) left footed shot from the centre of the box to the bottom left corner. Assisted by Dani Olmo.
Attempt saved. Andrej Kramaric (Croatia) right footed shot from outside the box is saved in the centre of the goal. Assisted by Mislav Orsic.