Messi looked to have inspired Argentina into a last-four meeting with Brazil's conquerors Croatia when he set up Nahuel Molina's opener 10 minutes before the break and then added the second from the penalty spot in the 73rd minute after Denzel Dumfries fouled Marcos Acuna.
Louis van Gaal, in his final game as Dutch coach, went for broke and it paid off as substitute Wout Weghorst led a sensational comeback by scoring twice, the second following an audacious free-kick routine 11 minutes into stoppage time.
A game of many flashpoints, including 17 yellow cards plus a red for Dutch defender Denzel Dumfries at the end, went to penalties, during which Aston Villa's Argentina keeper Emi Martinez emerged as the hero, saving from Virgil van Dijk and Steven Berghuis.
Messi scored his penalty and even though pressure mounted on Argentina when Enzo Fernandez dragged his spot-kick wide, Lautaro Martinez made the decisive contribution to spark wild scenes of celebration.
The ecstasy in the vast stands at Lusail Stadium and among Argentina's players carried extra joy because they knew how close they came to throwing away a position of comfort in this thunderous World Cup quarter-final.
Argentina were cruising with a two-goal lead in the final 10 minutes but even the hordes of blue and white clad fans were silenced momentarily as their team, seemingly gripped by desperation as the Netherlands utilised the giant duo of Weghorst and Luuk de Jong, conceded those two late goals.
It needed Emi Martinez's rescue act in the penalty shootout, although it was Argentina making all the running and the Dutch hanging on in the extra period, with Enzo Martinez hitting the post with virtually the last kick of the added period.
Argentina held their nerve to win the shootout and will now meet Croatia in the semi-finals after they also won on penalties against Brazil, a result which added another layer to the celebrations as they not only saw a historic rival go out, but also one of the main threats to their hopes of winning the World Cup.
This was a close-run thing for Argentina but they now stand only one game away from reaching the World Cup final, having falling victim to one of the biggest shocks of the tournament when they lost their opening game to Saudi Arabia.
Louis van Gaal disguised what was surely bitter disappointment in his final game as Netherlands coach as he clasped opposite number Lionel Scaloni in a warm embrace at the conclusion of a sometimes chaotic quarter-final.
Van Gaal must have been dreaming of another World Cup semi-final to follow 2014, which he lost on penalties to Argentina, when the Netherlands drew level in the closing seconds of that lengthy period of added time.
And what an equaliser it was, a superb free-kick routine which fooled Argentina completely as they waited for Tein Koopmeiners to shoot, only for him to slip a perfect pass into the waiting Weghorst to score.
Van Gaal can leave his post with his head held high, as can his team, after they showed resilience and character to overcome Argentina's supremacy, only to lose out on the lottery of penalties.
Time will tell whether 71-year-old Van Gaal, an occasionally divisive but always a charismatic and entertaining figure, will resurface elsewhere but his finale as Dutch coach was a case of so near and yet so far again in a World Cup.
-- Courtesy of BBC Sport