The game had looked to be going the distance at 0-0, but on 84 minutes Nagai latched onto a through ball by Hiroshi Kiyotake before expertly lofting the ball over the advancing Mohamed Amsif and into the vacant net.
Japan came into the game after a stunning win over Spain, while Morocco had to contend with a 2-2 draw with Hondruas, though it was the Africans who arguably controlled the opening exchanges and almost took the lead after 18 minutes.
Zakaria Labyad’s corner from the right caused a frantic scramble in the Japanese six-yard box, but when the ball fell to Amrabat his strike was blocked by a prone Gotoku Sakai. Labyad sufficiently quickened Japanese pulses 15 minutes later when he stung the palms of Shuichi Gonda with a vicious strike from 35 yards.
Japan got their first clear sight of goal when Amsif had clasped Daisuke Suzuki’s headed effort on the line before captain Yoshida had a gilt-edged effort, glancing a free header wide moments before half-time.
Neither side flew back out of the traps, but Morocco were again the first to craft a chance after the break. A slick and intricate passing move down the right saw them win a corner, but Abdelhamid El Kaoutari’s resulting header was easily claimed by Gonda.
Japan were restricted to a more a resolutely defensive showing than their free-flowing display against Spain, but they were inches from breaking the deadlock just after the hour mark. Keigo Higashi created space on the edge of the box, firing a sweeping left-footed drive. However, Amsif was just equal to it, tipping it onto the bar before getting lucky not to see it ricochet in off his back.
Amsif had to produce his best again minutes later to deny Yuhki Otsu his second of the tournament, diving to his right after the Japanese midfielder was allowed to charge through the Moroccan half and strike from range.
Japan continued to grow into the game and should have gone ahead after Hotaru Yamaguchi was put clean through, but struck his effort high over the bar. However, Nagai’s deft lob was enough to snatch the win, despite a late save by Gonda, denying Labyad.