Mattia Zaccagni curled home a 98th minute equaliser as defending champions Italy booked a last-16 spot at Euro 2024 with a 1-1 draw against Croatia, whose tournament hopes were left hanging by a thread, and will next face Switzerland.
Luka Modric gave Croatia a 55th-minute lead, moments after missing a penalty, and that looked like sending them through before late substitute Zaccagni bent a stunning finish past the despairing dive of Dominik Livakovic into the far corner.
The result left Italy second in Group B on four points, with Croatia third but now playing an anxious waiting game to see whether two points will be enough to take them through to the knockout stage as one of the best four third-placed sides.
Spain, who topped the standings, beat Albania 1-0 to finish with a perfect record in their three games and leave the eliminated Albanians rock bottom with one point.
Albania's loss also propelled sides not in action into the last 16 with England, France and the Netherlands now guaranteed to finish at least among the four best third-placed teams.
Italy had been rocked with defeat by Spain, which could have been more emphatic than the 1-0 scoreline, yet if there was some solace for Luciano Spalletti's side heading into Monday's match it was that Croatia had been even less impressive at the finals.
The Croats' 3-0 loss to Spain and 2-2 draw with Albania had left them on the precipice and one of the main issues that had dogged them at the tournament - how to turn possession into a goal threat - re-emerged in the first half against Italy.
Croatia barely gave the Italians a kick for most of the first 20 minutes but it was not surprising that they only had Luka Sucic's long range pile-driver, which was parried over by Gianluigi Donnarumma, to show for their efforts.
Italy looked far more purposeful with Mateo Retegui's having a couple of half chances before Alessandro Bastoni had the best opportunity of the first half, meeting Nicolo Barella's lofted ball to the far post with a header saved by Dominik Livakovic.
However, the second half was only minutes old when Croatia were awarded a penalty. Andrej Kramaric's shot struck the outstretched arm of halftime substitute Davide Frattesi and while referee Danny Makkelie waved play-on the VAR sent him to have a look at the screen and he swiftly changed his mind.
Modric stepped up to take the spot kick but his effort was saved brilliantly by Donnarumma low to the keeper's left, although it was only a momentary reprieve for Italy.
Seconds later, Croatia's halftime substitute Ante Budimir's header drew another superb save from Donnarumma but Modric was on hand to gobble up the rebound, which he fired into the roof of the net to atone for his penalty miss.
Italy pushed hard for a route back into the game and substitute Gianluca Scamacca was inches away from connecting with a cross in the 87th minute.
However, with Croatia's fans starting to celebrate what they though would be a victory, Italy struck a devastating late blow.
- Reuters