Hakim Ziyech and Youssef En-Nesyri each scored a first-half goal to lead Morocco to a 2-1 victory over Canada on Thursday and place first in Group F at the World Cup in Doha, Qatar.
Ziyech's blast opened the scoring in the fourth minute and En-Nesyri converted a long feed from Achraf Hakimi to double the advantage in the 23rd.
Morocco overcame Nayef Aguerd's own goal in the 40th minute and fended off six corner kicks from Canada to finish with seven points to win Group F and advance for the second time. They also successfully advanced from the group stage in the Mexico World Cup in 1986.
Canada was held without a point in its three matches at the World Cup.
--Croatia 0, Belgium 0
A scoreless draw in Al Rayyan allowed Croatia to gain a much-needed point and advance to the Round of 16.
Dominik Livakovic made three saves for Croatia, which finished with five points -- one more than Belgium.
Thibaut Courtois turned aside four shots for Belgium.
--Japan 2, Spain 1
Japan rallied from a 1-0 deficit in Al Rayyan, scoring two goals three minutes apart to stun Spain and win Group E.
Ritsu Doan tied the match in the 48th minute before Ao Tanaka buried the go-ahead goal in the 51st.
Tanaka's goal was nearly disallowed because the ball appeared to have rolled out of play before Kaoru Mitoma sent it to Tanaka for the assist. But it was upheld by VAR.
Keeper Shuichi Gonda made four saves as Japan picked up its second win of the World Cup and finished group play with six points.
Alvaro Morata found the back of the net in the 11th minute to put Spain on the board. The Spaniards still advanced to the Round of 16 by placing second in the group at four points and winning a tiebreaker over Germany.
--Germany 4, Costa Rica 2
Kai Havertz tallied two goals for Germany, but the two-goal win over Costa Rica in Al Khor wasn't enough to get the Germans out of Group E.
Germany finished on par with Spain at four points (1-1-1), but Spain had a plus-6 goal differential thanks primarily to defeating Costa Rica 5-0 in a previous match. Germany finished with just a plus-1 differential.
Serge Gnabry scored in the 10th minute and Niclas Fullkrug added one in the 89th minute for the Germans, who failed to advance out of the group stage for the second straight World Cup since winning the trophy in 2014.
Yeltsin Tejeda scored for Costa Rica (three points), which also benefited from an own goal by veteran German keeper Manuel Neuer.
--Field Level Media