Ecuador, who were also battling to stay alive in the tournament, claimed three valuable points courtesy of goals from Miller Bolanos and Enner Valencia.
Raul Jimenez scored Mexico's only goal of the match when he converted a penalty in the 64th minute.
Ecuador tested Mexico goalkeeper Jose de Jesus Corona in the first five minutes when the keeper saved a shot from Bolanos with his legs before deflecting a Christian Noboa strike.
Mexico almost took the lead in the 23rd minute when forward Vicente Vuoso's curling shot went just inches wide of the goal.
Bolanos broke the deadlock just three minutes later when he pounced on Valencia's blocked shot and fired the rebound into the roof of the net.
Mexico began to become more aggressive after Ecuador scored, but their aggression wasn't enough as a loss of possession in a dangerous area allowing Valencia doubling Ecuador's lead in the 57th minute.
However, Mexico pulled themselves back into contention when they were awarded a penalty after Gabriel Achilier's sloppy challenge on Hugo Ayala.
Jimenez made no mistake with the penalty, drilling it straight down the middle with Ecuador keeper Alexander Dominguez diving to his left.
With Mexico head coach Miguel Herrera growing increasingly frustrated at his side's inability to find an equaliser, he was eventually sent to the stands to watch his side lose the match and witness their Copa America dreams ended.
Ecuador now sit in third place in the Group A standings with three points having recorded one win and two losses in the three matches they have played. Mexico meanwhile finished with two points having drawn two games and lost one.