Enzo Fernandez netted the winner three minutes into stoppage time, capitalizing on a cross from Lautaro Martinez to complete a stunning comeback after Argentina had fallen two goals behind.
Egypt shocked the reigning champions by taking the lead in the 15th minute, as Yasser Ibrahim outjumped Lisandro Martinez to head the ball into the far corner.
The African team believed they had extended their lead midway through the second half with a goal from Mostafa Zico, but it was disallowed. Zico eventually found the net in the 67th minute, finishing expertly to make it 2-0 and put Argentina on the verge of elimination.
Lionel Messi had an opportunity to reduce the deficit earlier but saw his penalty denied by goalkeeper Mostafa Shobeir, marking his second missed penalty of the tournament.
However, Argentina refused to give up.
Cristian Romero ignited the comeback in the 79th minute, heading in unmarked from a set-piece, before Messi equalized four minutes later with a powerful shot from inside the box.
As extra time approached, Fernandez completed the turnaround in stoppage time, finishing off Lautaro Martinez’s delivery with a crucial header to propel Argentina into the last eight.
This victory keeps Argentina’s title defense alive following one of the tournament’s most thrilling knockout encounters.
They will face either Switzerland or Colombia in the quarter-finals in Kansas on Saturday.