The Real Madrid winger curled a low shot past Diego Benaglio after Lionel Messi's run and pass to see off a spirited challenge from Ottmar Hitzfeld's side.
Angel di Maria made up for a poor display by firing Argentina into the FIFA World Cup last eight with a 1-0 extra-time win over Switzerland.
Not for the first time this tournament, Alejandro Sabella's men struggled to make their presence felt in attack for large spells, with the Real Madrid midfielder guilty of conceding possession on a number of occasions.
However, Di Maria popped up with just two minutes of extra time remaining to sweep home after some good work by Lionel Messi.
Substitute Blerim Dzemaili headed against the post for Switzerland before time was up, and should have done better with the rebound.
PHOTOS: USA vs. Portugal | U.S. fan reactions | Beautiful people in Brazil
The result sets up a last-eight meeting for Argentina with Belgium or the United States in Brasilia, and was ultimately harsh on a Switzerland side which defended resolutely in what will now prove to have been Ottmar Hitzfeld's final game in charge before retiring.
Argentina was forced into one change, with Ezequiel Lavezzi coming in for injured striker Sergio Aguero, while Switzerland stuck with the same XI that triumphed 3-0 over Honduras in its closing Group E fixture.
Xherdan Shaqiri ran riot with three goals in that convincing victory, but chances were few and far between for both sides in the opening stages in Sao Paulo - a Gonzalo Higuain header that comfortably cleared the crossbar was as close as either came to hitting the target inside the first 25 minutes.
Switzerland injected some life into an otherwise dormant half in the 28th minute when Granit Xhaka and Stephan Lichsteiner were both denied by Sergio Romero in the Argentina goal, before Lavezzi called Diego Benaglio into action at the other end with his team's first accurate effort moments later.
Germany's Manuel Neuer produced a superb goalkeeping display in their last-16 clash on Monday, effectively acting as sweeper at times when his defense was breached by Algeria, but Argentine counterpart Romero was statuesque when Josip Drmic found himself clean through on goal in the 39th minute.
However, the Bayer Leverkusen striker's attempted chip was tame, and Romero gratefully clutched the ball to his chest.
Romero was far from convincing in keeping out a Shaqiri free kick from 25 yards five minutes into the second half, and Argentina looked short of ideas going forward, evoking memories of the last-gasp 1-0 victory over Iran in the group stage.
Benaglio denied Marcos Rojo from a tight angle as Argentina got a rare sight of goal, before Di Maria attempted a flamboyant cross.
Trying to be pleasing on the eye, he left his teammates far from pleased as his showboating resulted in a Swiss goal kick and an opportunity wasted.
Benaglio's reflexes were put to the test shortly after the hour mark as he tipped over from a powerful Higuain header, and Messi shot narrowly over soon after as the Argentinian pressure started to build.
Messi went close again with a drilled effort that Benaglio got down well to meet, but both nets remained untroubled as a last-16 clash entered extra time for the fourth time this tournament.
Having disappointed for much of the game, Di Maria ultimately emerged as the hero for Argentina.
The 26-year-old, who had earlier forced Benaglio into a fine save at his near post in the second half of extra time, received the ball following a probing run from Messi and calmly slotted a left-footed finish across Benaglio and into the far corner.
Dzemaili remarkably had a chance to equalize in injury time, but headed against the post from close range before failing to convert the rebound.