Ivan Perisic struck a sensational winner three minutes from time as Croatia ended Spain's 14-game unbeaten run at the European Championship finals to top Group D after a 2-1 victory on Tuesday.
Spain will now face Italy in the last 16 in Paris on Monday in a repeat of the 2012 final.
Alvaro Morata's early strike got Spain off to a flying start. But despite the absence of Luka Modric through injury, Croatia battled back to equalise before half-time through Nikola Kalinic.
Spain captain Sergio Ramos saw a penalty saved by Danijel Subasic 18 minutes from time.
And that miss proved vital when Perisic snuck the ball home at David de Gea's near post.
Croatia meet one of the best third-placed sides in Lens on Saturday.
Spain could also have to face world champions Germany in the quarter-finals and hosts France in the semi-finals if they are to reach the final in Paris on July 10.
"Now we have to dance with the favourites, but to be champions you have to beat everyone," said Ramos, who vowed Spain will learn from their mistakes.
Coach Vicente del Bosque would rather have avoided an early meeting with the on-form Italians.
- Italy clash -
"It is not ideal, that would have been to finish first (in the group)," said Del Bosque.
"We have to recover well. We are prepared to turn this situation around."
Morata's return to European champions Real Madrid from Juventus had been confirmed earlier on Tuesday.
And he moved level with club teammate Gareth Bale on three goals in the fight for the golden boot by finishing off a slick Spanish move after seven minutes.
David Silva's cute reverse pass picked out Cesc Fabregas's run and the Chelsea midfielder's cross was tapped into an empty net by Morata.
Spain looked rarely troubled at the back in their opening two games, but were given plenty of problems by Croatia even without star midfielder Modric.
Kalinic stung the palms of David de Gea before forcing an error from the Manchester United 'keeper as he dallied.
The loose ball fell to Ivan Rakitic and his brilliant chipped effort floated over Barcelona teammate Gerard Pique on the line before coming back off both the crossbar and post.
Morata had a great chance to double Spain's lead when he failed to control Fabregas's fine through ball with just Subasic to beat.
However, Del Bosque's men were pegged back right on half-time when Perisic's cross from the left was flicked home by Kalinic.
It was the first time Spain had conceded in 11 competitive games stretching back to October 2014 and first time they had conceded in the Euros for a record 733 minutes.
The goal knocked Spain out of their stride as Croatia pushed them onto the back foot at the start of the second period.
De Gea saved from Tin Jedvaj to atone for his own error in flapping at a cross before Marko Pjaca sent an acrobatic effort just wide from the rebound.
Pjaca also had claims for a penalty waved away as Croatia threatened the goal that would have taken them top of the group.
Del Bosque withdrew front two Nolito and Morata for the more physical presence of Bruno Soriano and Aritz Aduriz.
Spain were then handed a great chance to retake the lead when referee Bjorn Kuipers adjudged Silva had been pushed by Sime Vrsaljko inside the area.
Modric appeared to send on a message to Subasic when he saw his Real Madrid teammate Ramos step up to take the spot-kick.
And Subasic got lucky as his save was allowed to stand despite the fact he had encroached well before Ramos took aim.
Croatia took full advantage to blow the tournament wide open as Perisic lashed home to round off a clinical counter-attack.
AFP
Wed Jun 22 2016
Croatia's midfielder Ivan Perisic (R) celebrates his goal during the Euro 2016 group D football match between Croatia and Spain at the Matmut Atlantique stadium in Bordeaux on June 21, 2016. - AFP PHOTO / GEORGES GOBET
Kertas kabinet wujud sektor sukan dibentang dalam tempoh sebulan - Hannah
Hannah berkata dengan data yang lebih menyeluruh melibatkan sektor industri sukan nanti, pihaknya akan mampu merangsang pertumbuhan sukan di negara ini dengan lebih baik.
Tiga Syarikat Semikonduktor umum melabur di Pulau Pinang - Kon Yeow
Tiga syarikat semikonduktor dari China menyatakan komitmen untuk membuat pelaburan baharu di Pulau Pinang.
Pindaan garis panduan lawatan: Sekolah diharap susun semula program - Fadhlina
Semua sekolah diharap dapat menyusun semula program lawatan masing-masing berikutan pindaan Garis Panduan Lawatan Murid Sekolah pada tahun lepas bagi mengukuhkan pembelajaran di luar kelas, kata Menteri Pendidikan, Fadhlina Sidek.
Kebajikan pendidikan anak-anak dijaga sehingga tamat sekolah - KPM
Kementerian Pendidikan Malaysia akan memastikan kebajikan pendidikan anak-anak 10 pegawai dan anggota Tentera Laut Diraja Malaysia yang terkorban dalam nahas helikopter di Lumut, Perak, terus dijaga sehingga mereka tamat persekolahan.
Chegubard ditahan polis berkaitan hantaran mengenai kasino di Forest City
Chegubard ditahan di Ibu Pejabat Polis Daerah (IPD) Dang Wangi di sini berkaitan hantaran mengenai pengoperasian kasino di Forest City pada Sabtu.
Zahid minta pihak dalam BN buka "buku baharu"
Ahmad Zahid menegaskan senario politik tanah air sudah berubah dan terdapat banyak video lama dari parti lawan yang meminta pengundi menyokong DAP.
Malaysia kongsi pengalaman dalam usaha berterusan mempertahan Palestin
Delegasi negara akan berkongsikan peranan Malaysia dalam usaha berterusan mempertahankan nasib Palestin dalam Persidangan Liga Parlimen Al-Quds kelima yang berlangsung di Istanbul, Turki pada Sabtu.
Universiti Malaya mohon maaf kepada seluruh rakyat Malaysia
Jabatan Pengajian Antarabangsa dan Strategik, Universiti Malaya memohon maaf kepada seluruh rakyat Malaysia berhubung kenytaaan tidak bertanggungjawab Profesor Dr Bruce Gilley pada 24 April lalu.
Genting Malaysia nafi terbabit perbincangan
Selepas Berjaya Corporation Bhd dan Kerajaan Negeri Johor, kini Genting Malaysia Bhd pula menafikan sebarang penglibatan dalam perbincangan mengenai pengoperasian kasino di Forest City, Johor.
Berita tempatan pilihan sepanjang hari ini
Berikut adalah berita yang paling menjadi tumpuan sepanjang Sabtu, 27 April 2024.