Tottenham playmaker Giovani dos Santos was Mexico's hero with both goals in their Olympic Games Group B clash with Gabon at the City of Coventry Stadium.
Giovani, who struggled to earn a place under Harry Redknapp at White Hart Lane, was introduced as a second-half substitute and broke the deadlock after 63 minutes.
He then scored from the penalty spot in injury-time after Gabon defender Henri Ndong was sent off for a professional foul.
Former Barcelona player Giovani, signed for Tottenham by Juande Ramos four years ago, secured Mexico their first win of the tournament and put them on course for the quarter-finals.
Mexico were the first team to settle and a fierce drive from Marco Fabian was beaten away by the legs of Didier Ovono.
The Gabon goalkeeper also clung to a long-range effort from Hector Herrera away to his left.
Oribe Peralta's first-time shot flew just wide after he had taken a pass from Darvin Chavez in his stride.
But underdogs Gabon came more into the game and a low shot from Jerry Obiang stung the palms of Mexico goalkeeper Jose Corona.
Mexico's Diego Reyes and Ghana's Muller Dinda - the youngest player in the tournament at 16 - were booked in quick succession before half-time.
Mexico continued to dominate and Ovono parried Peralta's rising shot past the post.
But Ovono was eventually beaten by Giovani, who had a spell on loan at Racing Santander last season, after being teed up by Peralta.
The closest Gabon went to salvaging a point was when Pierre Aubameyang's shot was pushed away by Corona but then Giovani struck again from the spot with only seconds remaining.