Mexico kept their FIFA Under-20 World Cup hopes alive with a dramatic late winner Wednesday, as Portugal eased into the last 16 to leave Qatar facing an early exit.
After losing their opening match, Mexico were in the danger zone at 1-1 against Uruguay until Kevin Gutierrez's stoppage time free-kick secured a crucial win.
The result left Group D wide open, with every team on three points after Serbia defeated Mali 2-0.
Portugal's 4-0 win over Qatar saw them qualify from Group C with a game to spare and leave the Asian youth champions needing a miracle against Senegal in their final match.
Senegal managed a creditable draw against Colombia, although the South Americans remain second in the group thanks to their opening win over Qatar.
Mexico, who lost to Mali on Sunday, were looking at an early flight home unless they produced a result against Uruguay, who were finalists at the last tournament in 2013.
Both sides squandered chances in a goal-less first half -- Mexico when Guillermo Martinez's powerful header beat the Uruguay keeper, only to cannon into the crossbar.
Mexican keeper Jose Gonzalez then presented Uruguay with a gilt-edged opportunity, shanking his clearance straight to Franco Acosta, who shot wide of the open goal.
The breakthrough came in the 70th minute, when Hirving Lozano scooped up a loose Uruguay ball on the half-way line and rounded a defender before calmly slotting into the bottom corner.
Uruguay equalised in the 83rd minute, with Gonzales stopping one shot but unable to prevent Mathias Suarez winning a goal-mouth scramble to score off the rebound.
Discipline slipped as tensions rose and Uruguay's Erick Cabaco was sent off in the first minute of stoppage time after bringing down Martinez on the edge of the box.
Gutierrez stepped up to take the free kick, sending the ball looping over the wall and into the underside of the bar for a 93rd-minute winner.
In Group C, Senegal went ahead against Colombia after some individual brilliance from Dijon's Mamadou Thiam.
He trapped the ball just outside the area, then turned and barged past two defenders before unleashing a left-foot thunderbolt.
An Alexis Zapata penalty saw Colombia draw level before the break, leaving them in prime position to follow group leader Portugal into the next phase.
The Portuguese made short work of Qatar to qualify reach the last 16, rarely looking threatened as they romped home 4-0, including a goal in each half for winger Ivo.
Andre Silva scored the opener after latching onto Gelson Martins' defence-splitting pass, then Ivo added a spectacular second, sending on overhead scissor kick past the keeper.
Ivo scored another when he out jumped the defence in the 66th minute and headed the ball through the keeper's legs, then set up substitute Joao Vigario for the fourth.