Down to 10 men, Croatia looked set to earn a draw against Nations League champions Portugal, but Dominik Livakovic's error proved decisive.
Dominik Livakovic's calamitous late error gifted Portugal a 3-2 victory as Fernando Santos' side ended their Nations League campaign on a high note but Croatia avoided relegation from Group A3.
Croatia, reduced to 10 men early in the second half when Marko Rog received a second booking, seemed to be heading for a draw in Split on Tuesday.
Mateo Kovacic opened the scoring in the 29th minute before curling in from the edge of the box after goals from Ruben Dias and Joao Felix had put Portugal ahead.
But Livakovic endured a 90th-minute nightmare, fumbling a corner to the feet of Dias, who completed his double to snatch the points, yet Croatia avoid the drop due to France's win over Sweden.