Morocco edged past Canada to top Group F and reach 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, reports the BBC.
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 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 that rattled the crossbar and dropped down onto the line as Canada’s campaign ended without a point.
And Belgium were 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 in three matches.
They produced another lacklustre display against Croatia despite knowing a win was necessary to progress to the last 16.
Substitute Romelu Lukaku had numerous chances in the second half but failed to convert any of them.
Lukaku, still searching for sharpness following injury, poked an effort wide and then reacted too late when the ball hit him in front of goal in stoppage time.
Croatia, finalists in 2018, got the point they needed to progress from Group F as runners-up, with Morocco taking top spot thanks to a 2-1 win against Canada.
Zlatko Dalic’s side will face the winners of Group E – which is currently Spain – in the last 16.
Canada 1 – 2 Morocco*
Croatia* 0 – 1 Belgium