Argentina, twice gold medal winners, joined Morocco and Egypt in securing their spots in the men's Olympic football quarterfinals on the final day of the group stage on Tuesday.

All four teams in Group B were tied on three points before the last matches, but Javier Mascherano's Argentina qualified by defeating Ukraine 2-0 in Lyon, while Morocco comfortably advanced with a 3-0 win over Iraq in Nice.

Morocco, champions of the last year's Under-23 Africa Cup of Nations, finished with the same goal tally as Argentina but advanced as group winners due to their better head-to-head record. Morocco had previously beaten Argentina 2-1 in their opening match, after a late equalizer for the South Americans was disallowed following a VAR review.

Morocco will face the Group A runners-up in a quarter-final match on Friday in Paris, while the Group A winners will take on Argentina in Bordeaux. The United States and Guinea are also in Group A, potentially setting up a clash between Thierry Henry's French side and Argentina in the last eight.

Thiago Almada's brilliant strike put Argentina ahead against Ukraine just after halftime, and Claudio Echeverri secured their victory with a late goal. Morocco dominated Iraq, scoring all their goals in the first half, with Amir Richardson, son of former NBA star Michael Ray Richardson, heading in the opener.

Earlier, Egypt surprised Spain with a 2-1 win to reach the quarterfinals, with Ibrahim Adel scoring both goals. Egypt, led by former Arsenal midfielder Mohamed Elneny, will play their quarter-final in Marseille against the Group D runners-up.