But in the dying minutes, veteran defender Pepe popped up inside the penalty box to turn home an inviting cross, sending the match into extra time.
Silva then struck his first global goal after a handball inside the box on 104 minutes, while both sides finished with 10 men as Nelson Semedo was dismissed for Portugal before Raul Jimenez saw red for Mexico.
The teams of Portugal and Mexico met at this tournament on June 18 and played a 2: 2 draw. Portugal allowed Cristiano Ronaldo to leave ahead of their third-place match so he could be with his newborn twins.
Portugal spurned the chance to cap their strong start with the opening goal when Ochoa saved well from Andre Silva's spot-kick. The decisive goal was scored by Portugal's Adrien Silva from the penalty shot during the 104th minute of the game.
The final match between German and Chilean national teams will be held later on Sunday in St. Petersburg.
Mexico never has beaten Portugal in four matches (two losses, two draws).
Manchester United and Barcelona target Nelson Semedo was given his marching orders immediately after the interval.