Mexico scored twice in five second-half minutes in a thrilling last-ditch effort to stay in the World Cup on Wednesday, beating Saudi Arabia 2-1 but agonisingly missing out on the last 16 on goal difference.
Goals from Henry Martin and Luis Chavez soon after the interval catapulted Mexico back into contention, but a string of superb saves by Saudi keeper Mohamed Al-Owais and two disallowed efforts denied the Mexicans the elusive goal they needed to advance.
The match went right down to the wire and at one point looked like Mexico would miss out to Group C rivals Poland by virtue of having accrued more yellow cards, but Saudi striker Salem Al-Dawsari netted in stoppage time to make goal difference the decider.
Mexico's exit ended a run of seven successive last-16 appearances at the World Cup and the defeat for Saudi Arabia killed off what had looked to be a realistic chance of advancing from the group stages for the first time in 28 years.
Having failed to score in their opening two Group C matches, Mexico's chances of progressing had looked slim going into the match, hinging on the outcome of the game between Argentina and Poland which Argentina won 2-0 to top the group.
Urgently needing to beef up their goal difference, Mexico took the game to Saudi Arabia from the start and never stopped running, peppering the goal with long-range efforts in a desperate bid to wrest control of their own fate.
Orbelin Pineda and Chavez were the engines in a high-octane match that the Saudis struggled to get into, defending with desperation.
Mexico broke the deadlock two minutes after halftime, when Cesar Montes's deft back-heel from a corner found Martin who bundled the ball over the line in a crowded goalmouth.
They doubled their lead on 52 minutes when Chavez's powerful free kick 20 metres out sailed into the corner of the goal beyond the reach of Al-Owais, sparking wild Mexican celebrations on the field
Lozano found the net but his goal was disallowed and Mexico battled hard to get the decisive third but were denied constantly by the reflexes of Al-Owais in the Saudi goal.
Substitute Uriel Antuna had a stunning late effort disallowed for offside four minutes from time before Al-Dawsari shattered Mexican hopes when he grabbed a Saudi consolation goal deep into stoppage time.