Morocco edged past Canada to top Group F and reached the World Cup knockout stage for the first time in 36 years.
The Atlas Lions, whose previous trip to the last 16 came in 1986, finished above 2018 finalists Croatia, while Belgium – ranked second in the world – are out after finishing third in the group.
A tough test awaits in the next round against the team that finishes second in Group E, which could potentially be Spain or Germany.
Morocco went ahead after just four minutes courtesy of a goalkeeping howler from Milan Borjan.
The Canada keeper sprinted out of his goal but passed the ball straight to Hakim Ziyech, who lofted a cool finish into an open net from 30 yards.
The North African side doubled their advantage through Youssef En-Nesyri’s well-taken goal as he controlled Achraf Hakimi’s superb pass before firing in.
But sloppy defending gave Canada a route back into the game when West Ham’s Nayef Aguerd stuck a boot out to divert the ball into his own net – the 100th goal scored at this World Cup.
Knowing if they avoided defeat they would go through, Morocco were happy to sit back and soak up pressure in the second period.
But Atiba Hutchinson came close with a header rattling the crossbar and dropping down the line as Canada’s campaign ended without a point.
Morocco did not win a game at the last World Cup in Russia but have turned on the style this time, becoming the second African team after Senegal to make it through.
Morocco manager Walid Regragui has a team which is full of players with big-game experience.
Chelsea’s Ziyech, who has been off the boil for his club, has found form for his country and grabbed the opener, which was gifted to him by Borjan.
Hakimi and En-Nesyri, a regular scorer in the Champions League, combined for the second as the Sevilla player latched on to the Paris St-Germain full-back’s pin-point pass before smashing in.
He could have had a second but a stunning volley was ruled out for offside.
Before the game, Morocco had kept a clean sheet in all six matches under Regragui but that record went when Aguerd poked into his own net before the break.
Canada probed for a way back in the second half and although Hutchinson came close with a header which hit the woodwork, they failed to produce a shot on target in the match.
Star man Alphonso Davies stabbed a chance wide, meaning his side has now lost all six of their World Cup games, a feat only achieved previously by El Salvador.
For Belgium, they have been knocked out of the World Cup at the group stage as Croatia progressed at their expense with a goalless draw in Qatar.
Roberto Martinez’s side, who finished third in Russia four years ago and are ranked second in the world, have had a disappointing tournament with just one win and one goal in their three matches.
They produced another lacklustre display against Croatia despite knowing victory was necessary to progress to the last 16.
Substitute Romelu Lukaku had numerous chances in the second half but his failure to convert any sealed his country’s fate.
Lukaku, searching for sharpness following injury, hit the post from in front of goal, poked an effort wide when well-placed and reacted too slowly when the ball hit him in the six-yard box in stoppage time. -BBC