LENS, France (AFP) - Ricardo Quaresma headed Cristiano Ronaldo's Portugal into the quarter-finals of Euro 2016 three minutes before the end of extra-time to break Croatian hearts with the only goal in Lens.
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 kindly to Quaresma to head into an empty net.
He sprinted to the corner flag where he was mobbed by his teammates.
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 had been kept extremely quiet for the vast majority of the game as the dull encounter became the first match in European championship history where neither team managed a shot on target during the regulation 90 minutes.
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 even 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 at the start of the second period having enjoyed a day's more rest than Portugal and 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 ($39 million) 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 strong claims for a penalty waived 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 as 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.
And Portugal then snatched their first victory of the tournament at the death as Subasic's reflex save to keep out Ronaldo went unrewarded as Quaresma jubilantly nodded the ball in to the gaping net.