Argentina have booked their place in the last 16 of the World Cup at Nigeria's expense with a late 2-1 win at the Krestovsky Stadium this evening.
The two-time world champions were heading for a group-stage exit after Victor Moses scored a penalty early in the second half to cancel out Lionel Messi's impressive opener.
Needing victory to claim second place behind Croatia in Group D, Argentina rode their luck as Marcos Rojo volleyed home four minutes from time to spark dramatic scenes in St Petersburg.
Nigeria missed out on back-to-back knockout round appearances in the finals as a result of the defeat, having failed to take a couple of good chances through Odion Ighalo when on level terms, while Iceland also drop out of the competition.
In the wake of widespread criticism back in Argentina following the 3-0 loss to Croatia, Jorge Sampaoli made five changes to Argentina's starting lineup, most notably dropping Sergio Aguero and Willy Caballero at either end.
For the third match running the South Americans had a different formation, with Messi being paired alongside Gonzalo Higuain up top, and it was the Barcelona man who made the breakthrough for his side.
Ever Banega played the ball in over the top and Messi needed just two touches - one with his quad and the other with the outside of his boot - before firing it across Francis Uzoho and into the back of the net.
Messi, who was celebrating his first finals goal since netting in a 3-2 win against Nigeria in the group stage four years ago, then played Higuain through for what should have been a second goal.
Higuain was closed down by Uzoho and could not match Messi in finding a way past the young keeper, who was also needed later in the first half to push another Messi attempt - this time from a free kick - onto the upright.
Nigeria's only on-target attempt in the first half came from its final act, as John Obi Mikel flicked Oghenekaro Etebo's cross into the arms of debutant keeper Franco Armani.
The Super Eagles, who brought on Ighalo for the ineffective Kelechi Iheanacho midway through, headed into this match without a previous World Cup win against a non-European nation.
Their hopes of ending that run and reaching the last 16 for a fourth time were given a huge boost a few minutes into the second half, as referee Cuneyt Cakir pointed to the spot after Javier Mascherano got a hold of Leon Balogun inside the box when defending a corner.
To make matters worse for Mascherano, it was the ex-Barcelona midfielder who needlessly conceded the corner by heading a cross into one of his teammates and out of play.
Moses rolled the penalty the opposite way to Armani and all of a sudden it was Nigeria, and not the 2014 runners-up, who were in the running for a last-16 spot.
Despite Argentina needing a goal to avoid an early exit, Nigeria were creating the best openings in the final third of the match.
Wilfred Ndidi fired one over the bar following some good attacking play from Ahmed Musa, and then came a contentious moment which required the use of VAR.
Ighalo volleyed a Rojo clearance inches wide, but Nigeria's players felt that a penalty should have been awarded for handball against the versatile defender as he headed the ball into his own arm.
Cakir stuck to his original decision, though, and moments later Argentina could so easily have been ahead as an unmarked Higuain skied a glorious chance from 10 yards.
Ighalo missed a one-on-one seven minutes from time, with Armani keeping out the shot down low, and Etebo then sent a free kick into the side-netting as the South Americans were left badly exposed at the back.
The gamble to throw bodies forward paid off in dramatic style, though, as Rojo met Gabriel Mercado's cross and guided it past Uzoho for a late winner.
Argentina will now face France in Kazan on Saturday afternoon, while group winners Croatia - 2-1 winners against Iceland elsewhere this evening - take on Denmark in Nizhny Novgorod the following day.
ARGENTINA (4-4-2): Armani; Mercado, Otamendi, Rojo, Tagliafico (Aguero 80'); Mascherano, Banega; Perez (Pavon 61'), Messi, Di Maria (Meza 72'); Higuain
NIGERIA (4-2-3-1): Uzoho; Idowu, Balogun, Troost-Ekong, Omeruo (Iwobi 90'); Etebo, Ndidi; Moses, Mikel, Musa (Simy 92'); Iheanacho (Ighalo 46')