Quickfire second-half strikes from Henry Martin and Luis Chavez had put Mexico on course to reach the knockout stages 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.