Croatia avoided relegation from Nations League Group A3 despite losing 3-2 to Portugal in the final group game on Tuesday night.
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.
Diogo Jota and Cristiano Ronaldo went close as Portugal turned the screw, but the visitors had Dias to thank when he blocked Mario Pasalic's goal-bound effort at the other end.
Yet Dias could not prevent Croatia from opening the scoring – Kovacic lashing home at the second attempt after having his initial shot from Pasalic's cross blocked.
Portugal should have been two down eight minutes later, only for Josip Juranovic to head wide from inside the six-yard box, and Danilo Pereira would have made Croatia pay if not for Livakovic's instinctive stop.
But Portugal had their equaliser eight minutes into the second half.
Rog was shown a second yellow card for a foul on Ronaldo, whose free-kick was parried out by Livakovic and Ruben Semedo squared for Dias to add insult to injury by prodding in.
Portugal were in front on the hour-mark, with Joao Felix on hand to tuck in from Jota's lay off, yet Croatia defied their numerical disadvantage to hit back when Kovacic curled a low strike into the bottom-left corner.
Bernardo Silva squandered a golden chance to win it for Portugal, but his blushes were swiftly sparred by Livakovic.
The goalkeeper charged out to claim Joao Moutinho's corner, only to drop it after making contact with Dejan Lovren, enabling Dias to snatch victory.
Match Events
0' The match is about to start!
14' Jota's header wide out
19' Ronaldo almost catches the vicious cross in box
29' GOAL! Croatia 1-0 Portugal (Kovacic)
37' Juranovic's header wide out
45' Felix' shot stopped
48' Dias' header over the bar
51' Second Yellow Card! Rog sent off
52' GOAL! Croatia 1-1 Portugal (Dias)
60' GOAL! Croatia 1-2 Portugal (Felix)
64' GOAL! Croatia 2-2 Portugal (Kovacic)
76' Trincao's shot wide out
79' Bernardo's misses a great chance
90' GOAL! Croatia 2-3 Portugal (Dias)
Line-ups
Croatia XI: Modric, Perisic, Lovren, M. Škorić, Kovacic, D. Livaković, Pasalic, Rog, Vlasic, J. Juranović, D. Bradarić
Subs: Budimir, Badelj, M. Oršić, S. Sluga, A. Čolak, D. Melnjak, I. Grbić, Petkovic, B. Barišić, Brekalo, T. Bašić
Portugal XI:
Subs: