Brazil moved within two wins of back-to-back Olympic golds by beating Egypt 1-0 at Tokyo 2020.
A first-half strike from Matheus Cunha put Brazil through to the semi-finals.
At semis, they will face Mexico on Tuesday.
Japan will meet Spain in the other last-four match.
The hosts beat New Zealand 4-2 on penalties after a 0-0 draw.
Meanwhile, Spain came from the brink of elimination to beat Ivory Coast 5-2 after extra time.
Ivory Coast looked to be heading into the semi-finals when Max Gradel put Ivory Coast 2-1 ahead.
He scored in the first minute of added time at the end of the 90 minutes.
But Wolves striker Rafa Mir equalised with his first touch off the bench.
He then scored twice in extra time as Spain stretched away to reach the last four for the first time in 21 years.
While that game produced seven goals, Mexico’s match against South Korea featured nine.
The former won 6-3 to set up a semi-final with Japan.
Japan is now one win away from securing a first medal in men’s football since claiming bronze at the 1968 Games.