Messi scored a virtuoso goal from solo performance in the 14th minute to open the scoring, and made a classy through ball to help fellow striker Angel Di Maria took the winner on one-to-one situation before the break of extra time, which killed the 120 breathtaking minutes.
Argentine football great Diego Maradona, who came to cheer his home side, jumped to celebrate the late winner joyously in front of a fully-packed Shanghai Stadium of some 56,000 fans.
The legendary star witnessed the Albiceleste kept on going to win a back-to-back Olympic gold medal, but next they will have to beat their old foe Brazil in the semi-final.
It's a thrilling game with screams, tension, suspension throughout the whole process.
Although the South Americans enjoyed much more possession and created more chances, the Dutch side did well enough to contain their rivals with fierce physical battle and sharp counter-attacks.
Messi put the Argentines ahead single-handedly on 14 minutes, when the Barcelona prodigy intercepted a pass before the Dutch area and burst through the middle of two central backs before rounding the advancing keeper Kenneth Vermeer and drove home from small angle.
Otman Bakkal levelled the score for the Oranje in the 34th minute after a deflected freekick by Evander Sno luckily left him facing a helpless Oscar Ustari.
The lowlanders' 4-3-3 formation was tactically suitable to contain their opponents' 4-2-2-2, which concentrated more on the central attacks, and with the pace and physical strength the Dutch defenders boast, the game tended to be a war of fouls.
The Dutch players just did anything they can to stop the technical Argentines by fouls in every possible situation.
The game was more intensified in the second half. Sergio Aguero, boy friend of Maradona's younger daughter Giannina, could not delight his father-in-law by squandering two clear chances.
The Athletico Madrid hitman's low drive and header both missed the target.
Holland also created some great chances by Liverpool's Ryan Babel and Real Madrid's Royston Drenthe.
Drenthe's 87 minute curving shot and Babel's powerful drive could have ended the Argentines, but both went a little bit wide of the post.
In the extra time, both sides continued to launch sharp attacks, but the Albiceleste made the difference with Messi's magic power to harvest the difficult win.