Japan advanced to the quarterfinals of men's Olympic football after forward Kensuke Nagai scored an 84th-minute goal in a 1-0 win Sunday over Morocco.

Nagai received a long ball punted upfield as Morocco goalkeeper Mohamed Amsif charged off his line to try to deal with the danger. But the striker hit it over Amsif's head into an empty net.

Morocco had a late chance to equalize, but forward Zakaria Labyad's shot from close range was blocked by the Japan goalkeeper in stoppage time.

Japan tops Group D with six points and had a number of other chances to score throughout the match. The result leaves Morocco in third place with a point, behind Honduras and ahead of last-place Spain.