After drawing blanks in their opening two matches, Mexico scored twice in the space of five minutes of the second half to give Mexico a 2-0 lead on Wednesday as the Saudi defence appeared to collapse.
Henry Martin and Luis Chavez scored for Mexico in the thrilling Group C match, but agonizingly went out of the World Cup on goal difference on a night of incredible drama in Doha.
With Argentina beating Poland 2-0 in Group C at Stadium 974 and Mexico leading by the same scoreline at Lusail Stadium in the 94th minute, Gerardo Martino's side needed one more goal to prevent them from going out according to FIFA's fair play rule.
"It is a great success after all those years. France will be a big challenge. We didn't play a perfect game but we will analyse it and will try to have fun and attack," Polish star striker Robert Lewandowski said.
It was high drama because second place between Poland and Mexico was minutes away from being decided as a fourth tiebreaker, the Fair Play standings at the tournament based on yellow and red cards, which would have also seen Poland ahead.
Both would have been tied on points, an identical 2-2 goal difference, and having drawn their game 0-0, had Mexico won 2-0.
Mexico needed a win to advance, and, after coming close several times in the first half, Martin opened the scoring tapping in off a corner kick two minutes after the restart, and Chavez curled a 25m free-kick into the top right corner in the 52nd.
Chavez's free-kick from about 30 yards got a wonderful amount of whip onto it, curling it past the keeper for his first international goal. Knowing they had another goal to catch Poland, Mexico pressed on but had goals from Hirving Lozano in the 55th and Uriel Antuna in the 87th disallowed for offside.
But Salem Al Dawsari's injury-time consolation goal for Saudi Arabia sent the distraught Mexicans home, leaving the Polish players to celebrate across the turf.
The Mexicans needed one more goal to overtake Poland on goal difference and get through the group, but it was the Saudis who scored in the dying moments of the game making it 2-1.
Poland qualified from the group stage of a World Cup tournament for the first time since 1986. They had failed to do so in each of their previous three appearances at the tournament prior to this year (2002, 2006 and 2018). (IANS)