Di Maria’s erratic performance had been symptomatic of Argentina’s, but he produced the decisive moment of a largely disappointing game to set up a last-eight encounter with either Belgium or USA.
Switzerland created the best chances of a first half which failed to match the entertainment that has generally been on offer at the World Cup so far.
Granit Xhaka forced a smart low save out of Sergio Romero on 28 minutes following good work by Xherdan Shaqiri before Josip Drmic tamely chipped the ball straight at the Argentinian keeper after he had been sent clean through.
Argentina displayed greater impetus after half-time but, with Lionel Messi largely subdued, the two-time World Cup winners struggled to fashion clear chances.
Diego Benaglio saved well from Marcos Rojo and Gonzalo Higuain, before the Switzerland keeper was equal to Messi’s low shot and was then up quickly to deny substitute Rodrigo Palacio on the follow-up.
Di Maria brought a flying save out of Benaglio early in the second period of extra-time before the Real Madrid attacker sent Argentina into the last eight with two minutes to go by rolling a low shot beyond the Swiss keeper following a burst of pace from Messi.
Switzerland were agonizingly close to equalising in added time when the unmarked Blerim Dzemaili’s header from inside the six-yard box came back off the post and the rebound deflected wide off the substitute.
Alejandro Sabella looked a worried man on the touchline as his Argentina team failed to break through an organised Swiss defence in the early stages of the first half as their opponents looked far more dangerous on the attack.
Romero dived to his right to deny Xhaka with his feet and the Argentina goalkeeper saved the follow-up from Stephan Lichtsteiner.
Argentina offered only weak threats at the other end as Ezequiel Lavezzi, starting ahead of the injured Sergio Aguero, shot straight at Benaglio.