A close-range header from Portugal substitute Ricardo Quaresma secured a 1-0 win over Croatia after the game burst into life late in extra time on Saturday and set up a Euro 2016 quarter-final against Poland next week.
Quaresma struck three minutes from the end of the extra period after a Cristiano Ronaldo shot was brilliantly saved by Danijel Subasic to settle the tie just a minute after Croatia's Ivan Perisic had hit the post with a header.
Croatia almost snatched an equaliser at the death but Domagoj Vida hooked the ball agonisingly wide.
There was some lovely one-touch play from both sides but plenty of passes also went astray in a tense, cagey last 16 game in which neither side managed to register a shot on target until Ronaldo's late effort led to the winning goal.
Croatia held the upper hand for most of the first half but it was Portugal who had the first effort on goal when defender Pepe headed Raphael Guerreiro's free kick over the bar after Ronaldo was tripped by Perisic.
Perisic, who had a patch of his hair dyed to match the red-and-white checked pattern of his shirt, responded with an effort shortly afterwards for Croatia but after cutting in from the right he dragged his shot outside the near post.
Luka Modric and Mario Mandzukic, who sat out the 2-0 win over Spain due to injury, had both returned for Croatia, with Mandzukic spurning an excellent first-half chance when he headed Dario Srna's corner wide of the target.
With Mandzukic left to forage on his own up front and Nani and Ronaldo well-shackled, neither side were able to break the deadlock in the opening period and a smattering of boos and whistles were heard as the referee blew for halftime.
Croatia continued to dominate possession after the break, but their wasteful finishing continued as Marcelo Brozovic narrowly failed to connect with Ivan Strinic's cross and then followed up by blazing over from the resulting corner.
Lively substitute Renato Sanches registered Portugal's first shot of the second half when he broke forward and played a one-two with Joao Mario but steered the ball wide of the target.
Croatia centre-back Vida then had a glorious chance to give his side the lead on the hour but headed wide with the goal at his mercy and Mandzukic lurking behind him.
Earning his 100th cap, Nani was anonymous for much of the game but he did have an appeal for a penalty turned down when he went sprawling in the box under pressure from Strinic.
His strike partner Ronaldo did not fair much better and, despite occasional flashes of skill, he was kept quiet by the Croatia defence for most of the game.
The game finished scoreless and went into extra time with Nikola Kalinic, who replaced Mandzukic, blasting a shot wide halfway through the first period.
Croatia continued to look the more lively of the two sides and Vida was soon pulling his shirt over his face in frustration again as he headed another corner just over the bar with Subasic stranded after coming out for the cross.
Perisic flashed the ball across the goal with a few minutes remaining and then saw a header come back off the foot of the post before Portugal countered and Ronaldo's shot was parried into the path of Quaresma who scored the decisive goal.
Croatia poured forward in search of an equaliser and Vida made it a hat-trick of misses as he hooked the ball wide leaving Portugal to go through to face Poland in Marseille on Thursday.