Argentina's theme at this World Cup seems to be scrappy wins with Lionel Messi pulling through at the last minute to save the day.
This time he didn't score on his own, but set the stage for Angel Di Maria to score an extra-time winner against Switzerland.
"It doesn't matter if it's beautiful or ugly," Di Maria said. "Only that Argentina won and will play another game in the tournament."
Argentina will play Belgium in the quarterfinals.
Except for its final group-stage win over Nigeria, Argentina has won its matches in Brazil in the same manner — grinding down its opponents rather than dazzling them with brilliant football.
In the first half Tuesday, Argentina struggled to find paths through Switzerland's five-man midfield, and it was the Swiss that produced the best chances.
Granit Xhaka pushed Sergio Romero to a great save and Josip Drmic spoiled a great opportunity when he tried to chip the ball over the Argentina goalkeeper.
When cracks started opening in the defense in the second half, goalkeeper Diego Benaglio kept Switzerland in the game, stopping Gonzalo Higuain's header and Messi's low shot in the 78th minute.
Benaglio also saved a powerful attempt by Di Maria in extra time, and it looked like the Swiss would be able to push the game into a penalty shootout.
Then, in the 118th, Rodrigo Palacio won the ball in midfield and fed Messi, who dribbled down the middle in trademark fashion, escaping a challenge from Swiss defender Fabian Schaer before poking the ball to Di Maria. Unmarked, the Real Madrid player beat Benaglio with his 10th goal in Argentina's colors.
"What's important is that we moved on to the next stage," said Messi, who has scored four of Argentina's seven goals, including an injury-time winner against Iran. "It was difficult. We knew it was going to be a hard match."
Swiss substitute Blerim Dzemaili nearly equalized right before the end but his header hit the post, and the rebound bounced off his knee and wide of the goal.
Switzerland coach Ottmar Hitzfeld, whose brother died at age 81 one the eve of the match, said his team leaves the tournament with "our heads high."
"We made life very tough for them," he said. "They managed to keep their cool. It shows Argentina has a good team."
Hitzfeld said it was his last match as a football coach. He had earlier said he would quit after the tournament.
His Argentine counterpart, Alejandro Sabella, said he thought his team played a "wonderful match," though he conceded there's room for improvement.
"It was a match that we deserved to win," said Sabella. "The first half was very even. They had two clear chances and after that the match was ours."
Argentina will play its next match without left back Marcos Rojo, who is suspended after receiving his second yellow card on Tuesday.