Brazil beat Scotland to take Group C as Morocco stage late rally against Haiti
And Brazil left Scotland no space for heroics. Vinicius Junior struck twice in the first half and Matheus Cunha added the third on the hour mark.
In Atlanta, Morocco had to come from behind twice to secure their 4-2 win over Haiti.
Morocco goalkeeper Bono scored an own-goal to give Haiti the lead and a flurry of goals in the last 10 minutes of the half left the score tied at 2-2. Soufiane Rahimi scored Morocco's third goal in their 4-2 success over Haiti.
Soufiane Rahimip put Morocco ahead for the first time in the 78th minute and Rahimi turned provider in the closing minutes setting up substitute Gessime Yassine for his side's fourth goal.
Brazil to face runner-up from Group F
The results mean that Brazil will play their last 32 game against whoever finishes second in Group F out of Netherlands, Japan and Sweden in Houston on 29 June.
Morocco will take on the side that tops Group F on the same day in Monterrey.
"It was a crazy game, too many goals but we are really delighted to qualify for the next round and now we have to keep going," said Morocco captgain Achraf Hakimi.
"Haiti were already out of the competition but showed great spirit and made us suffer but in the end we did it."
Swiss outwit co-hosts Canada
In Group B on Wednesday, Switzerland claimed top spot following a 2-1 win over Canada in Vancouver.
Ruben Vargas and Johan Manzambi were on target for the Swiss who started the day in second place.
Ghana dig in for stalemate with England at World Cup
Though Canada substitute Promise David halved the deficit with 15 minutes remaining, Canada could not find the equaliser that would have given them the group.
Instead, they finished second on four points and in the last 32 will play the runner-up from Group A in Los Angeles on Sunday