Argentina scraped into the knockout stages of the World Cup as Marcos Rojo's late goal gave them victory over a spirited Nigeria side.
Though Argentina had to sweat for their victory at the Krestovsky Stadium, they got there in the end as they triumphed over a Nigeria side who will feel they should have done more with the chances they had.
The match began with a cagey opening ten minutes, Nigeria looking like the marginally stronger of the two sides but struggling to produce anything in the final third.
With chances at a premium during the early period, the match was in danger of growing somewhat stale - that is, until Argentina's captain produced a moment of magic to blow the game wide open.
Latching onto Ever Banega's long pass with a gorgeous first touch, Lionel Messi kept his cool to bring the ball under control and lash a right-footed effort across the face of Francis Uzoho's goal into the far corner of the net.
After receiving heavy criticism for his performances in Argentina's first two matches of the competition, Messi entered this game with a point to prove and the world's best footballer did not disappoint, causing Nigeria endless problems with his pace, dribbling and passing in attack.
Less than 15 minutes after his goal, Messi found Gonzalo Higuain with an inch-perfect through ball but the striker was unable to capitalise, seeing his shot saved by Uzoho.
Nigeria's 19-year-old stopper was the difference between his side and a much harsher scoreline at half-time, also managing to get his fingertips to Messi's arcing free kick to tip it onto the post.
Argentina looked to be in cruise control - until a moment of madness in the second half saw them throw their lead away, and quite possibly their hopes of qualifying for the knockout stages with it.
After needlessly giving away a corner, Argentina became the latest side to be punished for foul play in the penalty box when Javier Mascherano was judged to have impeded his man by holding onto him. After VAR was consulted, Victor Moses stepped up for Nigeria to coolly roll the ball past Franco Armani.
Things nearly became worse for Argentina with 15 minutes to go when referee Cuneyt Cakir was forced to check VAR after Marcos Rojo was accused of handling a ball which bounced off his head onto his arm. However, the referee stuck to his guns and refused to give the penalty, throwing Argentina a lifeline in the match.
The decision seemed to give Argentina more motivation to push on and restore their lead and they began to create more chances as the match entered its final ten minutes, Higuain blasting over from close range in the 80th minute when he really should have scored.
Eventually, however, La Albiceleste's pressure paid off and they were duly rewarded with a winner, Rojo popping up in Nigeria's penalty box to impressively volley home past the helpless Uzoho.
The victory sees Argentina finish the group stages with four points, meaning Sampaoli's team will face Group C winners France in the Round of 16.
As for Nigeria, their players have been left disappointed by their performance in this World Cup but the Super Eagles made a good effort to compete in a tricky group and the future is bright for Gernot Rohr's side.