Croatia provided late heroics as they came from behind to beat Spain and top Group D with a 2-1 win in Bordeaux.
Alvaro Morata had given Spain the perfect start with a seventh minute goal, but Nikola Kalinic levelled and Sergio Ramos had a penalty saved before Ivan Perisic scored late on after a devastating counter.
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.