Mexico beat New Zealand 2-1
Mexico needed second-half goals by Benfica's Jimenez and Peralta to grab victory over New Zealand in a bad-tempered match at Sochi.
Juan Carlos Osorio's side now just need a draw against Russia in Kazan on Saturday to be sure of reaching the semi-finals.
The Kiwis' superb first-half display and Chris Wood's shock goal rattled Mexico and a tense match boiled over with a mass brawl in the dying stages.
The match turned when Porto midfielder Hector Herrera came on for the second half and Mexico's attacks started to flow.
"I am proud of what my team did, it's normal to have to suffer at this level, but we deserved to win," said Osorio.
"We know how to adapt to different opponents."
New Zealand 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.
"Everyone is incredibly disappointed in the changing room and we feel we should have got more," said Hudson.
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.
After Herrera's introduction, Javier Aquino forced New Zealand keeper Stefan Marinovic into a left-handed save, before Giovani dos Santos fired over.
Mexico equalised when Aquino broke down the left flank and passed to Marco Fabian, who squared for forward Jimenez to fire home on 54 minutes.
And Peralta hit the winner in the 72nd minute when Aquino pulled the ball back for the 33-year-old to find the net.