A solitary goal from Yuki Otsu ensured Japan dealt 10-man Spain an early Olympic blow with a 1-0 victory over the world and European champions.
Sloppy defending from a corner allowed Otsu to tuck home from close range and with Inigo Martinez dismissed before the break, the underdogs held firm to treat Hampden Park to a surprise.
Japan had threatened periodically before the 34th-minute goal - Otsu eluding his man and scuffing past David de Gea on the half-volley from six yards.
A short back-pass nearly gifted Hiroshi Kiyotake a second moments later but Spain's problems deepened when Martinez surrendered possession to Kensuke Nagai and hauled him down to see red.
Keigo Higashi worked de Gea from range early in the second period, and Japan should have added to their lead either side of the hour with Nagai and Kiyotake both dragging wide when well-placed.
Nagai raced clear to force a good smothering stop from De Gea and Hotaru Yamaguchi fluffed a glorious chance at the death, but ultimately one goal was enough to earn Japan the leadership of Group D.
Earlier on in the same group, 10-man Morocco held on for a 2-2 draw with Honduras.