Raul Jimenez scored on a 16-yard bicycle kick in the 85th minute four minutes after Mexico had allowed the tying goal and El Tri beat Panama 2-1 on Friday night at Azteca Stadium to revive its hopes to qualifying for its sixth straight World Cup in Brazil.
Languishing in fifth place in North and Central America and the Caribbean, Mexico went ahead on Oribe Peralta's goal off a pass from Javier Hernandez in the 40th minute.
Panama, ahead of Mexico at the start of the night on total goals, tied the score in the 81st when Luis Tejada beat goalkeeper Guillermo Ochoa to a through pass, touched the ball around the keep and put it into the empty net.
Jimenez, who entered in the 83rd, received a cross with his back to the goal, tipped the ball in the air to himself and beat goalkeeper Jaime Penedo with an overhead kick.
In other World Cup qualifying action Friday:
Germany, Belgium and Switzerland qualified, while England and Russia won and moved into position to clinch next week.
Germany (8-0-1) defeated Ireland 3-0 at Cologne on goals by Sami Khedira, Andre Schuerrle and Mesut Ozil to guarantee first place in Group C and reach soccer's biggest tournament for the 16th straight time.
Belgium (8-0-1) earned its first berth since 2002, winning 2-0 at Croatia on a pair of goals by Romelu Lukaku to ensure first place in Group A.
Switzerland (6-0-3) clinched Group E with a 2-1 victory at Albania.
Thirteen of the 32 spots at next year's tournament in Brazil are set. The United States, Argentina, Australia, Costa Rica, Iran, Italy, Japan, the Netherlands and South Korea already qualified, and Brazil gets an automatic berth as host.
The nine European group winners qualify, and eight of nine second-place teams advance to playoffs, which will include Croatia and Sweden.
England (5-0-4) maintained its Group H lead, beating Ukraine 4-1 at Wembley on second-half goals by Wayne Rooney, Andros Townsend and Daniel Sturridge plus an own goal by Branko Boskovic on a mis-hit clearance attempt. England would clinch its fifth straight berth by beating visiting Poland on Tuesday.