The defending champions, Brazil defeated Mexico 4-1 on penalties after a goalless 120 minutes in Kashima.
Brazil goalkeeper Santos saved from Eduardo Aguirre in the shootouts before Johan Vasquez hit the post with Mexico’s second penalty.
Brazil reached back-to-back men’s Olympic football finals following a penalty shootout victory over Mexico.
They will play Spain in Saturday’s gold medal match. Dani Alves, Arsenal’s 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.
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