Ecuador stayed alive at the Copa America thanks to a 2-1 win over Mexico in Rancagua on Friday.
Needing a victory to at least stay in the hunt to be one of the two best third-placed teams, Ecuador hung on for the three points after goals from Miller Bolanos and Enner Valencia.
Raul Jimenez struck from the penalty spot for Mexico just after the hour-mark, but Gustavo Quinteros' men held on to jump into third in Group A.
It means Chile and Bolivia are guaranteed to go through, while Ecuador will need some luck as their goal difference (-2) leaves them as the third best third-placed team.
Quinteros' side had looked the more likely to score in the first half and they did, albeit with some luck, thanks to Bolanos' scrambled effort at the back post.
Bolanos and Valencia combined for the latter's goal in the 57th minute and Ecuador held on despite Jimenez's penalty, which came after a sloppy challenge in the area.
Ecuador made a lively start and gave Mexico goalkeeper Jose de Jesus Corona work to do in the opening five minutes.
Bolanos shot straight at the shot-stopper, who saved with his legs, before Corona palmed away a Christian Noboa strike.
Mexico's best chance fell to Vicente Vuoso, the man whose brace helped them draw 3-3 with Chile.
The forward was rewarded for his high pressing, turning over possession before curling a shot inches wide from inside the area in the 23rd minute.
Miguel Herrera's men would be punished for that missed chance soon after.
Valencia's hopeful shot from the left was blocked and fell to the back post, where Bolanos was quickest to react and scrambled into the roof of the net.
A Valencia header, which floated harmlessly over the crossbar, was the only chance of note in a scrappy start to the second half.
That proved to be a sign of things to come, as Valencia doubled Ecuador's lead in the 57th minute.
A poor turnover of possession in their own half put Mexico in trouble and Bolanos slid Valencia through, the West Ham forward getting across his defender with a touch before burying his finish.
Vuoso had a half-chance saved before Mexico were awarded a penalty after Gabriel Achilier climbed all over Hugo Ayala as a corner came in.
Jimenez stepped up and made no mistake from the penalty spot, going straight down the middle as Alexander Dominguez dived to his left.
Herrera was sent to the stands and his Mexico side were unable to find an equaliser despite their late pressure as their Copa America campaign came to an end.
Get the best features, fun and footballing frolics straight to your inbox every week.