Euro 2016 match report and highlights: Croatia 2-1 Spain
Ivan Perisic's late goal saw Croatia come from behind to beat defending champions Spain and advance to the knockout stages of Euro 2106 as Group D winners.
Alvaro Morata's early strike had given Spain the lead but Nikola Kalinic equalised just before half-time before La Roja defender Sergio Ramos saw a penalty saved midway through the second half.
Croatia then snatched the points three minutes from time when Perisic finished past David de Gea at his near post.
The 2-1 defeat means Spain finish second to Croatia and will meet Italy in the round of 16 on Monday in a repeat of the 2012 final.
Morata opened the scoring in just the seventh minute as the forward stole in to poke home Cesc Fabregas' effort from virtually on the goal-line.
An error from De Gea almost allowed Ivan Rakitic to equalise but the Barcelona midfielder's lofted attempt came back off the crossbar after possession had been gifted to Croatia.
David Silva hit a shot straight at Danijel Subasic before Nolito had an effort deflected wide as Spain looked to add to their lead.
Morata had the best chance to do just that but he wasted a chance with a poor touch having been slipped in by Fabregas just before the break.
And Croatia made them pay as they levelled on the stroke of half-time when Perisic crossed for Kalinic to flick home past De Gea.
The Manchester United goalkeeper was almost caught out once again in the second half, Marko Pjaca's overhead kick flashing just wide with De Gea stranded having failed to claim a cross.
Pjaca then had a penalty shout turned down after hitting the ground following a challenge from Ramos, who then headed a corner wide when free inside the Croatia box.
While referee Bjorn Kuipers had made the correct call at one end, the Dutch official awarded a soft spot-kick to Spain as Andres Iniesta's lofted pass into Silva led to the Manchester City man going down under pressure from Sime Vrsaljko.
Justice was done as Subasic saved Ramos' penalty, although it led to more controversy as the goalkeeper was almost six yards off his line by the time the Real Madrid man struck his effort.
And it was Croatia who ended the night as group winners as Kalinic found Perisic, whose low drive beat De Gea - with the 25-year-old again not at his best.