Croatian talisman Luka Modric struck a sensational second half goal to inspire a 3-1 win over Scotland in Glasgow on Tuesday and secure progress to the last 16 of Euro 2020.
The former world player of the year crashed a shot into the top corner with the outside of his right foot in the 62nd minute to salvage the campaign for Croatia, who were on the verge of elimination.
And it was Modric's corner that was headed in by Ivan Perisic 13 minutes from time to seal matters.
World Cup runners-up Croatia lost their first game to England and could only draw with the Czech Republic but with four points they edged second place and next meet the runners-up from Group E.
England topped Group D after a 1-0 win over the Czechs, who finish third behind Croatia on goals scored.
"I'd like to congratulate my team for a great match, we controlled the game very well," said Croatia coach Zlatko Dalic.
"We let the opponents back into the game with mistakes but we managed to relax and knew we would get the second goal and then the third."
Scotland had made a bright start as they chased the win which would have taken them into a knock-out phase for the first time but fell behind to Nikola Vlasic's goal in the 17th minute.
Callum McGregor equalized with Scotland's first goal at a major finals in 23 years but Croatia's quality showed through to leave home fans broken-hearted at Hampden Park once more.
Scotland's plans were disturbed by young star Billy Gilmour testing positive for the coronavirus after Friday's goalless draw with England and Stuart Armstrong replacing him was manager Steve Clarke's only change.
A furious Scotland start, like against the Czech Republic in their opener, went unrewarded as Croatia eventually triumphed with a touch of class - just as the Czechs did.
Modric, at 35, might be slightly past his peak but his finish high past David Marshall from 20 metres is unlikely to be matched in the tournament.
"That's what you're up against at this level - it was a tough lesson," McGregor told ITV.
It was particularly timely as a draw would have sent both teams out.
Scotland never looked like equalizing a second time having initially fallen behind against the run of play.
Perisic headed a deep cross back to Vlasic, brought into the starting line-up by Dalic, who finished well to open the scoring.
Croatia, inspired by Modric, gradually imposed themselves but John McGinn headed wide and had a shot saved.
Perisic curled just over but Scotland levelled in the 42nd minute when McGregor controlled a clearance and found the bottom corner from the edge of the box.
After the break home keeper David Marshall made two good saves before McGinn somehow bundled wide from close-range.
It proved decisive as moments later Modric's magic and Perisic's flicked header secured a first win for Croatia over Scotland in their sixth attempt and ensured the Scots of an 11th consecutive group stage exit at major finals.
"We came up against an excellent team tonight and they have experience at the major tournaments and they showed that," said McGinn.
"I feel we didn't do ourselves justice but we created history by coming here to a major tournament."