Mexico to finish level with Poland on four points but miss out on a spot in knockout rounds in Qatar because of an inferior goal difference.
Mexico have defeated Saudi Arabia 2-1 in World Cup Group C but fell agonisingly short of reaching the last 16 on goal difference.
Quickfire second-half strikes from Henry Martin and Luis Chavez had put Mexico on course to reach the knockout stages on Wednesday and Uriel Antuna also put the ball in the net but the effort was disallowed for offside.
Saudi Arabia pulled a goal back in stoppage time through Salem al Dawsari.
Mexico finished with four points, level with Poland who lost 2-0 to group winners Argentina and had a superior goal difference of one to advance.
That ended Mexico's run of seven straight last-16 qualifications stretching back to 1994.
Saudi Arabia were eliminated after finishing bottom of the standings on three points.