Mexico will play South Korea in the quarter-finals of the Olympics after beating South Africa 3-0 in their final group game.
El Tri's victory on Wednesday saw them finish second in the group behind Japan, who claimed top spot after beating France.
France's 4-0 defeat by Japan was the second time they had conceded four goals in the tournament, while Argentina and Germany also failed to make it through to the knockout stages.
- Man Utd misery: Fernandes penalty failure and defensive injuries pile early-season pressure on Solskjaer
- Man City masterclass: Guardiola finally finds a way to take down Tuchel's Chelsea
- Why Brentford are the Premier League's most innovative and unique club
- Inside Griezmann's Atletico Madrid nightmare - no goals, no assists, no shots on target
Who else is in the quarter-finals?
Brazil's hunt for a second consecutive Olympic gold medal will continue with a quarter-final clash against Egypt.
The 2016 winners beat Saudi Arabia on Wednesday to finish top of Group D with seven points, two ahead of Ivory Coast.
That result ensures Dani Alves and Co. continue to the knockout stages of the competition and will face the African side, who finished second in Group C.
Tournament hosts Japan finished top of Group A with a perfect record, beating South Africa, Mexico and France.
They have set up a tie with New Zealand, who beat Romania on goal difference to Group B's runners-up spot.
After finishing top of Group C with five points, Spain will take on Ivory Coast to fight for a place in the last four.
When will the quarter-finals be played?
All the matches will be played on Saturday July 31.
Spain vs Ivory Coast will be the first game to kick-off at Miyagi Stadium in Rifu, followed by Japan's clash with New Zealand. The Brazil tie follows, then South Korea will take on Mexico in Yokohama to round off the evening.
What is the quarter-final draw?
Spain vs Ivory Coast
Japan vs New Zealand
Brazil vs Egypt
South Korea vs Mexico