Lionel Messi and Argentina finally came alive at the World Cup.
Messi scored an exquisite 14th-minute goal to give the two-time champions the lead Tuesday, but it wasn't until Marcos Rojo's 86th-minute strike that Argentina was assured of a place in the round of 16.
Victor Moses scored a penalty in the 51st minute for Nigeria, putting Argentina in danger of being eliminated without winning a match in Russia.
It took an unlikely goal by Rojo to save Argentina and give it second place in Group D.
Diego Maradona, in the stands at the St. Petersburg Stadium, celebrated both goals wildly.
Argentina will play France in the last 16 in Kazan on Saturday.
CROATIA RESERVES HALT ICELAND 2-1
Fielding a side filled with reserves, Croatia ended Iceland's first ever World Cup run with a 2-1 win in Rostov-on-Don.
Milan Badelj crashed a volley against the bar, and moments later scored for Croatia in the 53th minute, sprinting into the area to fire a bouncing shot past goalkeeper Hannes Halldorsson.
Croatia playmaker Luka Modric led the already-qualified Croats for 65 minutes before being taken off, as his team remained in low-gear for most of the match to contain the Icelanders who had needed a win to hope for a place in the last 16.
Iceland equalized with a penalty shot taken by Gylfi Sigurdsson in the 76th minute after substitute Dejan Lovren carelessly handled the ball. But Ivan Perisic punished a defensive error to make it 2-1 at 90 minutes.
Russian fans at the 45,000-seat Rostov Arena rooted for the underdogs as the traveling Iceland supporters kept up their singing and chanting all evening.
Defender Sverrir Ingason twice threatened for Iceland, hitting the crossbar with a header in the second half.
DENMARK, FRANCE PLAY TO DULL DRAW
France, which already advanced, played out a 0-0 draw against Denmark to win Group C. Denmark earned the point it needed to move into the round of 16.
There was tension before the game at Luzhniki Stadium in Moscow. Denmark coach Age Hareide criticized France before the World Cup when he told a Danish newspaper the squad was "nothing special." He even suggested Paul Pogba was too focused on his hairstyles.
That irked the French team, and coach Didier Deschamps said the comments were "not something particularly pleasant."
But the game was often uneventful, requiring four saves from Danish goalkeeper Kasper Schmeichel and just one from French keeper Steve Mandanda.
The goalless draw was the first of the 2018 World Cup, and much of the 78,011 crowd whistled at misplaced passes and slow play as the game progressed.
AUSTRALIA FIZZLES AGAINST PERU
Australia needed a win against Peru, along with a Danish loss, to advance to the Round of 16, but got neither on Tuesday at the Fisht Stadium in Sochi.
Already eliminated, Peru took an early lead over Australia and didn't let it go, finishing the game 2-0 and sending Australia home. It was Peru's first World Cup win since 1978 in the country's first appearance at the tournament since 1982.
Thousands of Peruvians made the trip from South America and flooded every city and stadium where they played, and they gave the game a party atmosphere.
Andre Carrillo's 18th-minute volley gave Peru a 1-0 lead and its first World Cup goal since 1982, and captain Paolo Guerrero scored five minutes into the second half to give his team a 2-0 lead.
Seeking a spark, Australia brought on 38-year-old veteran Tim Cahill in the 53rd minute. It was his first appearance of the tournament and he came close to scoring in the 60th minute — he was bidding to join Pele, Uwe Seeler, Miroslav Klose and Cristiano Ronaldo as the fifth player ever to score in four World Cups.