PARIS — Cristiano Ronaldo dragged Portugal back from the brink of elimination twice, and Ireland found a late goal to stun Italy and stay in the European Championship on Wednesday.

Iceland’s winning goal in stoppage-time against Austria wrote another chapter of the tournament’s feel-good story and set up a round of 16 clash with England.

Belgium, widely seen as a potential champion, confirmed its place in the supposedly easier half of the knockout bracket by beating Sweden 1-0. The victory also signaled the start of Zlatan Ibrahimovic’s retirement from the Swedes’ national team.

Sweden and Austria are heading home now, as are Turkey and Albania, which had hung around in France hoping that results would fall their way and lead to a place in the last 16 among the best third-placed teams.

Those hopes were dashed on Wednesday.

Portugal and Ireland earned the final two slots on a day of wildly swinging fortunes and emotions – presaged by a pregame tantrum by Ronaldo. As the star walked with teammates beside a lake in a park, Ronaldo responded to a seemingly harmless question ahead of the game against Hungary by snatching the microphone off a TV reporter and apparently throwing it into the water.

“Are you ready for the game?” was all that had been asked by the journalist from the TV station of a Portuguese tabloid.

The star turned more heroic later as Portugal, needing at least a draw to advance, trailed three times to a Hungary side that already was sure to advance.

Ronaldo stepped up and created one equalizer for teammate Nani, then scored two himself in the second half – the first with an audacious flick of his right heel – as a thriller ended 3-3 in Lyon.

With one more goal when Portugal plays Croatia on Saturday in Lens, Ronaldo will tie Michel Platini’s career scoring record of nine goals at European finals tournaments.

Ronaldo seemed destined for yet another knockout encounter with old rival England until Iceland’s Arnor Ingvi Traustason scored in the last of four added minutes. Now Nice will welcome Iceland to play the English on Monday.

Ireland delighted its passionate throng of green-clad fans in Lille when Robbie Brady headed an 85th-minute goal to win 1-0 against Italy, which already was sure to top Group E.

Other round of 16 fixtures were slotted into place after the group-stage was completed Wednesday.

Northern Ireland now knows it will play group winner Wales in a British derby match in Paris on Saturday – a draw that includes two-time defending champion Spain, World Cup holder Germany, host France, Italy and England.