Argentina squeezed into the quarterfinals of the World Cup thanks to a last-gasp extra-time winner from Angel Di Maria.
The South American side dominated possession in the first half, but they would have been behind at the break had Josip Drmic not wasted a glorious chance to put Switzerland ahead.
The Swiss withstood a barrage from Argentina for the rest of the evening, but their excellent goalkeeper Diego Benaglio was finally beaten with two minutes of extra time left and Alejandro Sabella's men walked away with a 1-0 win.
Benaglio had earlier kept Switzerland in the match with superb saves from Di Maria, Rodrigo Palacio and Pablo Zabaleta.
Lionel Messi had a quiet game, only testing Benaglio on two occasions, but he played a key role at the end in setting up Di Maria for the goal.
Seconds after Di Maria's strike, Blerim Dzemaili had a great chance to take the game to penalties, but he hit a post and then missed a simple tap-in for the follow-up, meaning Argentina advanced to a quarter-final meeting with either Belgium or the United States.
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.
The Swiss were looking far more dangerous on the attack.
Sergio Romero dived to his right to deny Granit Xhaka with his feet and the Argentina goalkeeper saved the follow-up from Stephan Lichtsteiner.
Argentina offered only weak threats at the other end. Ezequiel Lavezzi, starting ahead of the injured Sergio Aguero, shot straight at Benaglio.
Switzerland had to resort to some tough tactics to tame the Argentinians at times, though. A few late tackles flew in and referee Jonas Eriksson ran out of patience, booking Xhaka for tripping Lavezzi.
Romero frayed Argentinian nerves just after the break when he juggled Shaqiri's free kick on the line, but he collected the ball at the third attempt.
Argentina dominated the rest of the second half, but Benaglio would not be beaten.
Marcos Rojo stung Benaglio's palms with a fierce shot and the Swiss stopper then stretched to tip over Gonzalo Higuain's header.
Messi hit a spectacular left-foot volley that flew inches over the bar.
Switzerland coach Hitzfeld brought Gelson Fernandes on and within 10 minutes he had received a booking for hacking down Di Maria.
Sabella also made a change, bringing Rodrigo Palacio on for Lavezzi. The Inter Milan striker missed a glorious chance with his first touch -- a free header that flew wide from Messi's cross.
With 13 minutes left Benaglio showed immense bravery to push the ball away from Palacio's feet as he followed up Messi's shot from the edge of the area.
Benaglio had to be alert for the final 10 minutes of the 90 as Argentina launched attack after attack, but he held strong and the game went to extra-time.
Benaglio remained the busiest man on the pitch after the restart, saving in quick succession from Pablo Zabaleta and Higuain.
At the start of the second period Benaglio again saved superbly from Di Maria.
A penalty shootout seemed inevitable, but Di Maria finally beat Benaglio with two minutes left.
Palacio won the ball on the halfway line and laid the ball to Messi, who squared for Di Maria and he curled his shot into the net.
Wild celebrations ensued, but Switzerland piled forward and they would have equalised a minute later had Dzemaili not hit a post and missed the rebound from two yards.