The Barcelona superstar was at his brilliant best at Estadio Beira-Rio on Wednesday, following up a half-volley off a rebound with a superb free kick.
His efforts, though, were twice cancelled out by the equally impressive Ahmed Musa as Nigeria put in a spirited display.
The Super Eagles eventually succumbed as Marcos Rojo's unorthodox finish five minutes after halftime ensured Argentina went through with a maximum haul of nine points.
While Nigeria entered its final Group F fixture needing a draw to guarantee progression, Bosnia-Herzegovina's 3-1 triumph over Iran meant that the African side qualified anyway.
The Africa Cup of Nations champions will face France in the last 16, while Argentina will tackle Switzerland after Group E concluded later on Wednesday.
Any hopes Nigeria had of getting the point it required were dented immediately as Messi fired the two-time champions ahead.
Angel Di Maria was instrumental, charging into the area before unleashing a fierce strike that hit the post, struck the back of goalkeeper Vincent Enyeama and bounced back onto the woodwork.
Unfortunately for the African side, as the ball ricocheted back into the area, Messi was on hand to power home a sublime half-volley.
But Nigeria was not willing to be the supporting act for long and leveled a minute later. Musa picked up the ball on the left flank before cutting inside and expertly bending a curling effort beyond Sergio Romero.
Di Maria was causing his team's greatest threat, his low 25-yard strike forcing a good save from Enyeama. Yet Messi assumed center stage again to re-establish his side's lead.
Having forced a fine save from Enyeama with a curling set piece, he left the Nigeria goalkeeper stranded from exactly the same position in first-half injury time after the mercurial Barcelona man had been brought down by Kenneth Omeruo.
Far from downhearted, Nigeria found an almost immediate riposte after the interval as Musa ran into a huge gap between the Argentina center backs and slotted past Romero, having been picked out by Emmanuel Emenike.
However, as the momentum swung once more, Argentina moved in front for the third time just three minutes later, Rojo kneeing Ezequiel Lavezzi's corner home in unorthodox fashion.
Suddenly attacking with renewed verve, Alejandro Sabella's men began to look increasingly threatening. Enyeama had to be on high alert to keep out a Higuain effort before Messi slid a shot wide.
The Argentina captain was withdrawn in the 63rd minute, to a rapturous ovation from the crowd.
Sabella's side barely missed a beat in his absence, although some poor finishing - summed up by Di Maria hitting straight at the goalkeeper towards the end - ultimately meant that it could not add to its three-goal tally.