Oribe Peralta got the winner for Mexico as they came from behind to beat New Zealand 2-1 on Wednesday and move closer to the Confederations Cup semi-finals.
After Leeds United striker Chris Wood gave the All Whites a shock first-half lead, goals by Benfica's Raul Jiménez and Peralta after the break sealed the win.
The result in Sochi saw Mexico leapfrog Portugal, who earlier beat Russia 1-0 in Moscow, into top spot in Group A by the slenderest of margins on goals scored.
Juan Carlos Osorio's side now just need a draw against Russia in Kazan on Saturday to be sure of reaching the semi-finals, but New Zealand are bottom and out of the tournament.
New Zealand's superb first-half display rattled Mexico and a tense match boiled over with a mass brawl in the dying stages.
Osorio said the match turned when Porto midfielder Héctor Herrera came on for the second half and Mexico's attacks started to flow.
Mexico coach Osorio: "We deserved to win"
"We improved greatly when Héctor came in and we have to see what happens now against Russia," Osorio commented.
"I am proud of what my team did, it's normal to have to suffer at this level, but we deserved to win. We know how to adapt to different opponents."
NZ coach Anthony Hudson had vowed they would bounce back after Saturday's opening 2-0 defeat by Russia and his team were true to his word.
Kiwis boss Hudson praises team's "incredible" first-half display
"Everyone is incredibly disappointed in the changing room and we feel we should have got more," said Hudson. "It was an incredible first-half performance from us.
"The first 10 minutes after the break, we gave them too much space and time on the ball."
Wood's superb strike was New Zealand's first goal in four matches and only the third time they have scored at a Confederations Cup in four campaigns.
With star striker Javier Hernández on the bench, Mexico's three-man attack of Peralta, Jiménez and Juergen Damm struggled to make an impact early on.
There was also no place for promising winger Hirving Lozano, 21, who signed a six-year contract for PSV Eindhoven on Monday.
Mexico lost Carlos Salcedo on 33 minutes when the defender was stretchered off with a shoulder injury after coming second-best in a tussle with Wood.
The New Zealand forward had the best of the early chances when he twice forced Mexico goalkeeper Alfredo Talavera into saves.
Lewis sets up Wood to put NZ ahead
The Oceania champions took a shock lead when Clayton Lewis threaded his pass between two defenders to Wood, who coolly fired home on 42 minutes.
With the Kiwis' tails up, Wood could have grabbed a second when he again got in behind the defence, but failed to control the ball as they took a one-goal lead into the break.
After Herrera's introduction, Javier Aquino forced New Zealand keeper Stefan Marinovic into a left-handed save, before Giovani dos Santos fired over.
At the other end, Wood squandered a one-on-one with Talavera and moments later Mexico were level.
Jiménez and Peralta goals complete second-half turnaround
Aquino broke down the left flank and passed to Marco Fabian, who squared for forward Jiménez to fire home.
Peralta hit the winner in the 72nd minute when Aquino pulled the ball back for the 33-year-old to find the net.
But the Kiwis kept battling and with Mexico allowing them plenty of space to attack, midfielder Ryan Thomas clattered the woodwork with five minutes to go.
New Zealand defender Tommy Smith then cleared Jiménez's shot off the line in the dying stages, just before a mass brawl broke out after Herrera clashed with Thomas.
Referee Bakary Gassama consulted the video assistant referee and Herrera was booked after a delay of over four minutes.