Brazil reached back-to-back men's Olympic football finals following a penalty shootout victory over Mexico. The defending champions won 4-1 on penalties after a goalless 120 minutes in Kashima.
Brazil goalkeeper Santos saved from Eduardo Aguirre in the shootout before Johan Vasquez hit the post with Mexico's second penalty. They will play Spain in Saturday's gold medal match.
Dani Alves, Gabriel Martinelli, Bruno Guimaraes and Reinier all scored their spot-kicks for Brazil.
It looked like the second semi-final was heading for penalties until Marco Asensio scored in the 115th minute in Saitama against hosts Japan.
The Real Madrid winger came off the bench to score the winning goal with a superb curling strike from inside the box to send Spain to a first Olympic final since they finished runners-up at the 2000 Games in Sydney.