Japan booked their place in the last eight, winning a hard fought game against the north Africans, who must now beat Spain in their last match to stand any chance of progressA late winner from Kensuke Nagai gave Japan a 1-0 win over Morocco at St James' Park to ensure their place in the quarter-finals.
Nagai lobbed home with just seven minutes remaining, after racing onto a clever flicked pass from Hiroshi Kiyotake, giving the Blue Samurai a deserved win against a Moroccan side lacking any punch or penetration.
Japan, winners in their first match against the much fancied Spanish at Hampden Park, made one change, with highly-rated right-back Hiroki Sakai not fully fit to start the match, therefore, his namesake Gotoku Sakai, started in defence.
Morocco also made just the single change to the side which drew 2-2 with Honduras in their opener, with Zakarya Bergdich, suspended after his red card in that game, replaced by full-back Abdellatif Noussair.
Pim Verbeek's team started brightly, fashioning a chance in the fourth minute when Nordin Amrabat timed his run into the box to perfection, but Japan skipper Maya Yoshida did just enough to put the Morocco striker off.
With the talented wingers Zakaria Labyad and Soufiane Bidaoui on either flank, it was no surprise to see the north African side utilising the wings at every available opportunity and one such move saw them force an 18th minute corner from which Amrabat had a chance following a knockdown, but his shot was well blocked by Sakai.
Three minutes later and more terrific work on the right-flank from Bidaoui saw him bamboozle the Japanese left-back Daisuke Suzuki, but the Lierse wideman's cross was behind the onrushing Labyad and the chance was lost.
Labyad, a new arrival in the Portugese capital Lisbon this summer having completed a move to Sporting, decided he'd have a go from distance in the 34th minute, and his 30-yarder almost caught out Shuichi Gonda at his near-post, but the keeper was alert enough to make the save.
Takashi Sekizuka's side, outstanding on the counter-attack in their surprise victory over Spain - when they really should have won by more than just the single goal - struggled to trouble the Moroccans in the opening 35 minutes, but almost took the lead when Yuki Otsu curled a splendid 25-yard effort just wide.
Japan's goal against Spain came from a set-piece and they almost opened the scoring in a similar manner here, not once, but twice, before the half-time interval.
First, an inswinging corner from the right found the head of Suzuki, and his header was just about stopped on the goalline by Mohammed Amsif, when some in the stadium thought it had crossed the line.
Moments later, a corner from the opposite side found the head of Yoshida, but his glancing header went wide of Amsif's left-hand post, the final chance of a lacklustre half.
With the tempo noticeably quicker in the second-half, Morocco set about taking control of the match, aware that a point would be a better result for their opponents than themselves and forced a succession of early corners, but struggled to threaten the Japanese goal, Amrabat coming closest with a curling effort in the 58th minute, which went a yard wide.
Moments later however, and after 15 minutes spent almost exclusively in their own half, Japan were unfortunate not to be in front themselves.
A swift breakaway saw the ball arrive at the feet of Hiroshi Kiyotake, who drifted from the flank into a central area, before unleashing a terrific left-footed effort which Moroccan keeper Amsif did outstandingly well to tip onto the crossbar, before collecting the ball as it landed nearby, to ensure the stalemate continued.
Suddenly, Japan appeared reinvigorated and Otsu, the matchwinner in their opening game, forced another excellent save from Amsif, down low to his right to turn away the Japanese' 20-yard daisy-cutter.
From the resultant corner, skipper Yoshida again got his head to the ball, but under heavy pressure could only direct his effort over the crossbar from six yards.
With 15 minutes remaining Verbeek's response was to withdraw Bidaoui, replacing him with Brescia's defensive midfielder Omar El-Kaddouri, looking to stop Japan from breaking through the centre of his side.
However, it made no difference initially as Japan created the game's most clear-cut chance, from which they should have taken the lead.
Bursting through midfield, Hotaru Yamaguchi played a clever one-two with the previously anonymous Nagai, but presented with a golden opportunity, the Cerezo Osaka midfielder fired his shot over the crossbar.
Now firmly in the ascendency, Japan continued to attack and with seven minutes remaining, their bold approach got its reward.
Under pressure in the centre of the field, the impressive Kiyotake clipped the ball over the Morocco defence for Nagai to chase, and seeing Amsif charging from his goal-line to meet him, the 23-year-old striker lobbed the ball from 30-yards into the unguarded net.
With a lead to hold onto, the Asian side were more than happy to let the match drift to its conclusion, but Morocco, aware that without an equaliser their opponents would be certain of a place in the quarter-finals, looked to put some pressure on the Japanese goal, and almost levelled in the 92nd minute.
An aimless punt was flicked on by Barrada, but Labyad, clear of the last defender, saw his effort saved by Gonda, before Barrada's follow up was cleared by Tokunaga, ensuring victory for the Blue Samurai.