A late goal by Premier League target Radja Nainggolan earned Belgium a last-16 berth with a 1-0 win over Sweden ending superstar Zlatan Ibrahimovic's international career with a defeat.
The Roma midfielder, reportedly wanted by Chelsea, controlled a cross from Eden Hazard outside the area and powered it into the net in the 82nd minute.
After a poor display against Italy in their group opener, Belgium now take on Hungary in Toulouse on June 26 with the momentum of two wins behind them.
"We have got better since the Italy game, kept two clean sheets in a row," said Marc Wilmots, Belgium's coach.
"It will be a complicated game, we watched the last minutes of their game against Portugal, Hungary leave 200 per cent on the field," said Belgium skipper Eden Hazard who was awarded man-of-the-match.
There was to be no salvation for Sweden, nor one more game for Ibrahimovic.
He battled to the end, almost snatching a late equaliser with a half volley on the turn, but the dying minutes were instead marked by the Belgian fans raucously chanting "Bye Bye Ibrahimovic!"
"It's heavy, it's disappointing, but at the same time I enjoyed it, we got the possibility to play at the Euros, and represent Sweden," said Ibrahimovic.
"At the same time I am proud, this was my last game in the national team, I have many fantastic memories."
Sweden coach Erik Hamren said Ibrahimovic was a "unique" talent that cannot be replaced.
"I hope we can find another player, not a Zlatan as I don't think in a small country like Sweden you can find someone like that, he's really unique," said Hamren.
Sweden finished bottom of the group and will look back with regret on a flat performance in their opener against Ireland.
"Our two last games were not bad, but we couldn't finish our chances in either," added Hamren. "Against Ireland we weren't very good, maybe in attack we could have been better against Italy. But I can't ask more from my players, I'm proud of them, even though we lost the game," he said.
Facing elimination if defeated, both teams pushed forward to attack which produced a pulsating first half hour in balmy Nice.
Chances came thick and fast, Sweden almost grabbing a dream start three minutes in when a goalmouth half-volley by Marcus Berg, in for John Giudetti as strike partner to Ibrahimovic, was batted out by Thibaut Courtois.
Belgium launched regular raids with Kevin De Bruyne through the middle and Hazard, roving from wing to wing, at the heart of the danger.
Midway through the half, a backheel from Hazard let the Man City star fire a shot straight at the Isaksson.
At the other end, Ibrahimovic had little joy, bar the occasional half-chance snapshot or attempt at a spectacular volley.
But none came to anything on an ultimately frustrating night for the Swedish legend who announced his international retirement after Euro 2016 on Tuesday.
It was Belgium who nearly entered the break in front, when Meurier headed an inch-perfect De Bruyne cross just wide of Andreas Isaksson's post.
As the clock ran down in the second half the temperature began rising again as Belgium wasted a host of chances to kill of Swedish hopes.
Isaksson dived at full length to keep out a De Bruyne drive before a powerful Romelu Lukaku break was foiled by Isakksson who spread his body well to block the shot.
A minute later, an identical run by the Everton striker, this time with a neat finish, was ruled offside.
Time was running out on Ibrahimovic when he went close with a free-kick turned away by Courtois with a quarter hour to go before De Bruyne cleared off the line.
But Nainggolan secured a richly-talented Belgian side's place on the favourable half of the draw with a rasping drive into the far corner.