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.
#Croatia stays in the tier of #NationsLeague! #BeProud #Family #Vatreni pic.twitter.com/HyTAnjAgsG— HNS (@HNS_CFF) November 17, 2020
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.
2 - Rúben Dias is the first defender scoring a brace for Portugal in a game in the 21st century; he had never scored a goal for Portugal before tonight's game. Surprise. #CROPOR #NationsLeague pic.twitter.com/0z1ExsARzK— OptaJoao (@OptaJoao) November 17, 2020
What does it mean? Croatia survive, Portugal second
France's victory over Portugal on Saturday ensured Les Bleus' place in next year's Finals, with Portugal relinquishing their Nations League crown.
World Cup 2018 runners-up Croatia could have dropped to League B had they failed to win and Sweden overcome France, but they will remain at the top table for the next Nations League campaign thanks to a 4-2 victory for Didier Deschamps' side.
Dias breaks international duck in style
Defender Dias has made an impressive start to life at Manchester City and the former Benfica centre-back turned in a clinical display in front of goal on Tuesday.
A constant presence in both boxes, the 23-year-old is the first defender to score a brace for Portugal in the 21st century, having never previously netted for his country.
Fernandes kept under wraps
Bruno Fernandes is a key man for Manchester United, though he is sometimes restricted to more of a background role for his national side.
The playmaker lasted just 45 minutes and was unusually sloppy in possession, completing just 61.8 per cent of 34 attempted passes, with his replacement Trincao – who drilled wide from a chance he did well to craft himself in the 76th minute – injecting more urgency to Portugal's play.
While the fixtures have not yet been confirmed, both of these teams will be in friendly action in March, ahead of playing in the Euros.