Defending champions Argentina needed an extra-time own goal to avoid one of the greatest upsets in World Cup history as they edged World Cup debutants Cape Verde 3-2 in a thrilling last-32 encounter.
Ranked 64th in the world, Cape Verde twice fought back to level the score and came within minutes of taking the holders to a penalty shootout before cruelly falling short.
Argentina will now face Egypt in the last 16 after surviving an unforgettable test in Miami.
Messi puts champions ahead
Argentina looked set for a routine evening when Lionel Messi produced another moment of brilliance in the 29th minute.
The captain expertly brought down Lisandro Martinez's long pass before firing into the roof of the net for his 20th World Cup goal.
Despite trailing, Cape Verde refused to be overawed.
Their persistence was rewarded in the second half when Deroy Duarte burst into the penalty area and squeezed a powerful finish through Martinez's legs and beyond Emiliano Martinez from a tight angle to spark wild celebrations among their supporters.

Extra-time drama keeps fans on edge
The match exploded into life in extra time.
Just two minutes after the restart, Lisandro Martinez restored Argentina's lead by meeting Alexis Mac Allister's flick from a corner with a fierce finish.
Cape Verde responded in spectacular fashion.
Sidny Lopes Cabral produced one of the goals of the tournament, cutting inside before curling an unstoppable strike into the top corner beyond Emiliano Martinez to level the contest once again.
Cabral almost completed a fairytale moments later, forcing a brilliant save from the Argentina goalkeeper as Cape Verde chased a famous winner.
Cruel ending for Cape Verde
With penalties looming, Argentina finally found the decisive breakthrough in the 111th minute.
Cristian Romero's header struck defender Diney Borges and deflected into his own net, ending Cape Verde's remarkable resistance in heartbreaking fashion.
The underdogs continued to fight until the final whistle, but Argentina held on to book their place in the next round.
Cape Verde earn global admiration
Although their World Cup journey ended in defeat, Cape Verde left the tournament with enormous credit after pushing one of football's giants to the brink.
Veteran goalkeeper Vozinha was outstanding once again, producing eight saves, including a superb one-on-one stop against Messi and a fingertip save from the Argentine captain's free kick.
At full-time, Argentina's players, including Messi and Emiliano Martinez, consoled their devastated opponents, recognising the extraordinary effort from a side that captured the imagination throughout the tournament.
Argentina remain on course to defend their world title, but they were forced to dig deeper than anyone expected against a fearless Cape Verde side that announced itself on football's biggest stage.