Oribe Peralta scored with a swerving long-range strike and then set up another goal with a backheel to help Mexico to a 3-1 victory over Japan on Tuesday and secure a spot in the final of the men's Olympic football competition.
Mexico will play either Brazil or South Korea in Saturday's final.
"We are guaranteed a silver, but we want a gold," Mexico coach Fernando Luis Tena said. "Mexico is a football nation. They must be partying tonight."
Mexico's previous best showing at the Olympics was in its 1968 home games, when the team was beaten 2-0 by Japan in the bronze medal match.
Japan, which had yet to improve on its 1968 performance, opened the scoring with a 12th-minute strike by Yuki Otsu. The forward sent a swerving shot into the roof of the net from outside the penalty area after several quick passes had carved out a sliver of space for him.
Mexico kept pressing, and Marco Fabian headed in a corner for Mexico before halftime to equalize.
On 65 minutes, Peralta won the ball off Japanese defender Takahiro Ohgihara, who lingered too long after keeper Shuichi Gonda had rolled it to him. Peralta ran with the ball briefly then shot high and to the left of Gonda to give Mexico the lead.
Deep in added time, substitute Javier Cortes ran onto a Peralta backheel, beat a defender and then shot under Gonda to seal the victory.
"We had a good start but then stopped moving," said Japan coach Takashi Sekizuka. "Everyone is very disappointed. But we need to get over our emotion and prepare for the next game."
Photograph: Kirsty Wigglesworth/AP