Lens - Ricardo Quaresma headed Portugal into the Euro 2016 quarter-finals three minutes before the end of extra-time to break Croatian hearts after dominating the game.
Cristiano Ronaldo was denied matching Michel Platini's record of nine goals in European championship finals by a fine save from Danijel Subasic, but the ball fell to Quaresma to head into an empty net.
"We knew the difficulties we were going to encounter, the stress, the anxiety that comes with the game, but I think we should congratulate ourselves because we believed until the end," said Quaresma.
Portugal will face Poland in the quarter-finals in Marseille on Thursday after the Poles beat Switzerland 5-4 on penalties after a 1-1 draw earlier on Saturday.
Ronaldo was kept extremely quiet for most of a dull encounter which became the first match in European Championship history where neither team managed a shot on target during the regulation 90 minutes.
Croatian boss Ante Cacic was left to bemoan his side's inability to turn possession into goals.
"We cannot say football is fair, we had many chances, we dominated for the whole match, so it was not a psychological problem," said Cacic.
"The best team doesn't always win and that happened tonight."
Portugal were the only side to progress to the last 16 despite not winning any of their three group games and coach Fernando Santos took an extremely cautious approach.
Ronaldo did not touch the ball in the Croatia box during the first-half, but Portugal were doing enough to limit a Croatia side that had thrilled in beating defending champions Spain 2-1 in midweek to precious few chances.
Star midfielder Luka Modric returned from injury for a matchup with his Real Madrid teammate Ronaldo, but both he and Barcelona's Ivan Rakitic struggled to sparkle as they had earlier in the tournament.
It was another Real Madrid player who had the best chance of the first-half when Pepe nodded Raphael Guerreiro's dangerous free-kick over.
Ivan Perisic was Croatia's hero with the winning goal against Spain, but he pulled their best chance of the opening 45 minutes into the side-netting from a narrow angle.
Croatia upped the pace in the second period having enjoyed a day's more rest than Portugal. Marcelo Brozovic should have done better when he blazed over from a quickly taken corner.
Santos looked to inject some life into the Portugal midfield by introducing wonderkid Renato Sanches and the 18-year-old, who Bayern Munich paid Benfica €35 million euros for last month, nearly made an instant impact.
After a lovely series of one-twos with Nani, Sanches took aim from the edge of the area only to drag his weak shot wide.
Domagoj Vida headed a great chance wide for Croatia from Rakitic's fine cross as the game began to come to life in the final quarter.
Nani then had penalty claims waved away by Spanish referee Carlos Velasco Carballo when he appeared to be kicked in the chest by Ivan Strinic as he burst into the box.
However, unlike so often at Euro 2016, there was no late drama. Both sides settled for the stalemate to take the game into extra-time.
Croatian boss Ante Cacic replaced ineffectual Juventus striker Mario Mandzukic with Nikola Kalinic, but the Fiorentina forward fired the only chance of the opening period of extra time wildly wide.
Vida had another golden chance when he headed wide with the Portuguese goal gaping after Rui Patricio failed to collect Brozovic's corner seven minutes from time.
However, Patricio made himself a hero seconds later when he turned Ivan Perisic's header onto the post.
Portugal then snatched their first victory of the tournament at the death as Subasic's reflex save to keep out Ronaldo went unrewarded. Quaresma jubilantly nodded the ball in to the gaping net.