Japan pulled off the first shock of the Olympic football competition by beating 10-man Spain 1-0 at Hampden Park.
Spain were second favourites for gold having won the last three major tournaments, as well as last year's European Under-21 Championship.
But Yuki Otsu's 34th-minute strike was enough for Japan's first win over Spain at any level after Inigo Martinez was sent off in the 41st minute.
Earlier in Glasgow, Honduras drew 2-2 with Morocco in the other Group D game.
Spain now go into Sunday's match with Honduras bottom of the group, despite starting with Euro 2012 winners Jordi Alba, Javi Martinez and Chelsea midfielder Juan Mata.
In similar style to the senior side, Spain dominated possession early on, with Mata forcing a fine save from Shuichi Gonda, but Japan threatened more often and were rewarded when Otsu lost Martin Montoya to turn in Takahiro Ohgihara's corner.
Hiroshi Kiyotake should have doubled Japan's lead after pouncing on a wayward Alvaro Dominguez backpass and Inigo Martinez was then shown a straight red card for pulling down Kensuke Nagai just outside the area.
Manchester United goalkeeper David de Gea was called into action just after the break to deny Keigo Higashi, before Nagai fired wide when through on goal.
Kiyotake spurned a similar chance after a fine run through the Spanish defence and although Spain brought on Chelsea midfielder Oriol Romeu, Japan could have made victory more emphatic on the counter-attack, with De Gea denying Nagai before Hotaru Yamaguchi fired wide in stoppage time.
Abdelaziz Barrada had earlier given Morocco a 39th-minute lead with a superb volley, before Jerry Bengtson's tap-in gave Honduras a 56th-minute equaliser.
Bengtson put Honduras in front with a 65th-minute penalty but Zakaria Labyad levelled two minutes later and Morocco held on for a point after Zakarya Bergdich was sent off for kicking out at Mario Martinez with 18 minutes left.