Argentina and Lionel Messi progressed to the last 16 of the World Cup by the skin of their teeth on Tuesday after an 86th-minute strike from defender Marcos Rojo gave them a 2-1 win over Nigeria and eliminated the African side.

Croatia advance as winners of Group D with the maximum nine points after beating Iceland 2-1 and Nigeria were just minutes away from joining them before central defender Rojo superbly volleyed home a Gabriel Mercado cross from the right.

Messi had put Argentina ahead in the 14th minute, with a fabulously taken goal but the Africans equalised through a Victor Moses penalty in the 51st minute and the twice World Cup winners struggled to respond to that setback with a ragged second half display.

In front of a massive following of passionate and loud Argentine fans, the game began in ideal fashion for Jorge Sampaoli's side, who had managed just a point from their opening two games.

A perfectly weighted diagonal ball over the top by Ever Banega was sublimely brought down on the outside of his thigh by Messi who then drove past Nigeria's teenage keeper Francis Uzoho to open the scoring.

The selection of Banega proved to be an inspired one by Sampaoli with the Sevilla midfielder providing the quality service that had been lacking in their opening two games.

Messi finally scored in this World Cup but needed help from his teammates in St. Petersburg. Giuseppe Cacace/AFP/Getty Images

Banega almost set up a second goal for the Argentines when he put Angel Di Maria clear, the winger being brought down by Leon Balogun and Messi struck the woodwork from the resulting free kick with a curler from the left against the far post.

It had been an impressive half from Argentina but the game was to take a twist shortly after the interval.

Defending a corner, Argentine defender Javier Mascherano jockeyed Leon Balogun inside the area and when the Nigerian fell to the floor, Turkish referee Cuneyt Cakir awarded a penalty.

After lengthy and impassioned protests from the Argentine players, Moses managed to keep his cool and slot past Franco Armani to level the scores.

Argentina were fortunate not to concede another penalty just before 80 minutes when a headed clearance by Rojo hit off his arm, forcing the referee into a video review after which he did not give the spot kick.

Nigeria wasted several chances to add a second and secure their place in the last 16 before the unlikely goal from Manchester United defender Rojo kept Argentina's tournament alive and sent Nigeria home.

Argentina go on to face Group C winners France on Saturday in the next round while Group D winners Croatia take on Denmark.