Mexico exited the World Cup in dramatic fashion, missing out on a place in the last 16 to Poland on goal difference, despite beating Saudi Arabia 2-1 on Wednesday.

Mexico were leading 2-0 into stoppage time, which, coupled with Poland’s defeat to group winners Argentina by the same scoreline, meant the two teams would finish level on points, goal difference, goals scored, goals conceded and head-to-head record having drawn their opening group game 0-0.

Stream on ESPN+: LaLiga, Bundesliga, more (U.S.)

But with Poland having a narrow edge on fair play points, Mexico had to continue to pour men forward in search of a goal to send them to the knockout stage. And in doing so, they were caught on the break by Saudi Arabia to mean Poland advanced by one goal (0 GD for Poland, -1 for Mexico).

For Mexico, it is the first time they will not feature in the World Cup knockout stage since 1990, when they were banned from the tournament. The last time El Tri qualified for the tournament and failed to make it out of the group stage was in 1978.

After going goalless through their first 2 1/2 matches and 430 minutes in total at the World Cup dating back to 2018, Mexico exploded to life in spectacular fashion to start the second half Wednesday at Lusail Iconic Stadium.

Henry Martin finally broke the deadlock in the 47th minute, finishing from close range after a flicked-on corner to give Mexico hope. Just five minutes later there was pandemonium. From almost 35 yards out, Luis Chavez sent a free kick arrowing into the top corner to put Mexico 2-0 up and within sight of the knockout stage.

When Argentina soon went 2-0 up on Poland, Mexico needed just one more goal to progress.

Repeatedly they came agonizingly close to to achieving it. Hirving Lozano found the net but saw the goal ruled out for offside and then Martin really should have scored but volleyed over the bar with just the goalkeeper to beat, immediately dropping his head into his hands.

More pain was to follow when substitute Uriel Antuna broke clear behind the Saudi defense and applied the finish but again the offside flag went up.

And as Mexico continued to desperately surge forward through seven minutes of stoppage time, Saudi Arabia broke and delivered the final blow to El Tri’s hopes thanks to Salem Al-Dawsari‘s goal.