Match ends, Nigeria 2, Argentina 3.
Argentina and Nigeria both qualified for the last 16 of the World Cup despite two Lionel Messi goals condemning the African side to a 3-2 defeat in their final group game.
The Barcelona forward netted a fierce opener, but Ahmed Musa equalised within 80 seconds with a curling finish.
Messi made it 2-1 before the break with a 25-yard free-kick, but Musa grabbed his second after bursting through.
Marcos Rojo scored Argentina's winner, knocking in a corner with a knee.
The result means Argentina finish top of Group F with three wins from three games, while Nigeria qualify in second with four points after Iran failed to defeat Bosnia-Hercegovina.
Nigeria will face France in the last 16 in Brasilia next Monday, while Argentina take on Switzerland a day later in Sao Paulo.
They progressed after another goal-laden World Cup match.
It only took three minutes for the deadlock to be broken as Messi smashed home after Angel Di Maria's effort came off a post.
The celebrations had barely died down when Nigeria levelled. Midfielder Michel Babatunde - who was later stretchered off with a wrist injury - fed the ball into the left side of the area for Musa, who shifted to his right before curling in.
It was the first time in World Cup history that two opposing teams had both scored inside the first five minutes.
The forwards on show continued to expose the fragility of both defences, but it was not until stoppage time in the first half that the next goal arrived.
Messi, who moments earlier drew an exceptional save from Vincent Enyeama with a free-kick, struck a set-piece over the wall and beyond the reach of the Lille goalkeeper.
It was the 27-year-old's fourth goal in three matches at Brazil 2014, having scored just once in his first eight World Cup appearances.
Nigeria knew Bosnia-Hercegovina had taken an early lead against Iran, the African team's rivals for qualification, but they did not sit back and were level again within two minutes of the restart.
Musa was the goalscorer again, the CSKA Moscow forward playing a one-two Emmanuel Emenike before slotting the ball past Sergio Romero.
Argentina pressed once more, with Di Maria twice forcing Enyeama to make good stops. But the Nigeria goalkeeper was beaten when defender Rojo used his knee to convert a corner from the left.
A desperate Di Maria was thwarted again by Enyeama in the closing moments, as the match ended in the same thrilling manner in which it began.
- 13OshaniwaBooked at 51mins
- 22OmeruoBooked at 48mins
- 18BabatundeSubstituted forUcheboat 66'minutes
- 8OdemwingieSubstituted forNwoforat 80'minutes
- 10MessiSubstituted forÁlvarezat 63'minutes
- 7Di María
- 9HiguaínSubstituted forBigliaat 90+1'minutes
- 20AgüeroSubstituted forLavezziat 38'minutes
- Nicola Rizzoli
- Shots on Target
Second Half ends, Nigeria 2, Argentina 3.
Ricardo Álvarez (Argentina) wins a free kick on the left wing.
Foul by Ogenyi Onazi (Nigeria).
Foul by Ezequiel Lavezzi (Argentina).
Kenneth Omeruo (Nigeria) wins a free kick in the defensive half.
Delay over. They are ready to continue.
Substitution, Argentina. Lucas Biglia replaces Gonzalo Higuaín.
Delay in match Juwon Oshaniwa (Nigeria) because of an injury.
Attempt saved. Javier Mascherano (Argentina) right footed shot from outside the box is saved in the top centre of the goal. Assisted by Fernando Gago.
Corner, Nigeria. Conceded by Ezequiel Garay.
Attempt blocked. Efe Ambrose (Nigeria) right footed shot from the right side of the box is blocked. Assisted by Ogenyi Onazi.
Attempt saved. Ángel Di María (Argentina) left footed shot from the left side of the box is saved in the top centre of the goal. Assisted by Gonzalo Higuaín with a through ball.
Attempt missed. Emmanuel Emenike (Nigeria) right footed shot from outside the box misses to the left. Assisted by John Obi Mikel.
Attempt blocked. Ogenyi Onazi (Nigeria) right footed shot from outside the box is blocked.
Attempt blocked. Michael Uchebo (Nigeria) right footed shot from outside the box is blocked. Assisted by Uche Nwofor.
Corner, Nigeria. Conceded by Federico Fernández.
Foul by Gonzalo Higuaín (Argentina).
Efe Ambrose (Nigeria) wins a free kick in the attacking half.
Substitution, Nigeria. Uche Nwofor replaces Peter Odemwingie.