[Read: Belgium beat USA 2-1]
After being frustrated for much of the match, Real Madrid winger Di Maria finally broke the Swiss resistance in the 118th minute.
The match exploded after the goal as the Swiss, who for the entire game played for the penalties, finally showed some urgency and almost equalised but the post came to the rescue of stunned Argentine players.
Argentina will now play the winner of a later match between Belgium and the United States.
It was a match of attrition for both sides -- Argentina's attack against the Swiss defence.
Argentina lacked the cutting edge and found it extremely hard to break down a well organised Swiss defence.
Switzerland, who had one of the best defensive records in the qualifying stage where they won seven of the ten matches, packed men at the back.
Argentina made their third consecutive quarter-finals since 2006
Argentina, who have heavily relied on Messi's goals, failed to string together quick passes with the Barcelona star seeing very little of the ball in the first half.
Whenever Messi did get the ball, he created sorts of problems for the Swiss but didn't get the support he is so used to while playing for the Catalans.
Switzerland, though had the best chance of the match but Granit Xhaka's 26th minute shot was brilliantly saved by Argentine goalie Romero.
Argentina had five shots in the first half with four hitting the target while the Swiss had three of their four shots in target.
The South Americans came out with more purpose in the second half.
Messi played a more central role and had a bigger say in the proceedings than he did in the first.
Argentina dominated possession with the Swiss finding it hard to get out of their own half.
But for all the creative play Messi and co threw at them, a wall of red shirts were always there to repel any danger.
Switzerland defended stoutly to hold on, but Argentina kept piling on the pressure and as the match wore on Messi became increasingly dangerous.
Messi almost bailed out Argentina once again but his 77th minute low shot got the best out of Swiss keeper Benaglio.
Such was the domination of the Argentines that they had 21 shots by the end of second half with 16 on target.
Swiss could manage just nine shots with a paltry five on target.
In extra time, it was all the same story as Argentina once again threatened but just couldn't get the better of the Swiss defence.
Messi cut a frustrated figure in the field. Everytime he received the ball there were at least two Swiss defenders on him.
Angel di Maria emerged as Argentina's danger man in the second half.
He constantly managed to wriggle into space but failed to find the final ball.
Argentina had another shot on target but Di Maria's shot was beaten out by a flying Swiss goalie.
Swiss had absolutely nothing to offer in attack and the front men relied just on counter attacks.
With just two minutes to the end of extra time second period, Messi found Di Maria free in the box and the winger slotted the ball in the back of the net to break Swiss hearts.
The unthinkable nearly happened as Shaqiri fired a brilliant cross into the area and Dzemaili met it with a good header.
His effort, however, struck the left-hand post and then hit him again before going out of play.