Argentina made a major comeback in the final minutes of play against Egypt on Tuesday, narrowly securing a spot in the quarterfinals with a 3-2 finish.

The defending champions trailed 2-0 against Egypt with 11 minutes remaining when Cristian Romero started the rally by scoring with a header in the 79th minute.

Lionel Messi, who was in tears after the final whistle, scored his eighth goal of the tournament and record-extending 21st goal at the World Cup in the 83rd to level the score at 2-2 and Enzo Fernandez completed the comeback in injury time.

For much of Tuesday's game, it looked like it would be a painful exit for the 39-year-old Messi in what might be the last of his six World Cups.

Egypt led after goals in each half from Yasser Ibrahim and Mostafa Zico and could have been ahead 3-0 if not for a video review that ruled out another score.