Emiliano Boffelli kicked 19 points to help Argentina to a dramatic 29-17 victory over Wales in Marseille on Saturday to set up a World Cup semi-final against New Zealand.
Los Pumas came into the quarter-final at the Stade Velodrome as underdogs, having finished Pool D as runners-up to England while Wales booked their place in the quarters with a perfect four wins from four in Pool C.
But Argentina played the territorial game, and while not shining in attack, proved to be solid in defence, disruptive at the line-out and disciplined enough to contain a fancied Welsh side seeking to make the semi-final for the third time in four tournaments.
"It was a difficult game. I am very happy for the team," said Boffelli, adding that coach Michael Cheika had told them at half-time "that we need to keep going and keep going, and that at some time the game would open for us."
Wales captain Jac Morgan called the result "devastating."
"We knew they were going to be a physical team, they always are. We just had to front up against that. But discipline and a couple of errors let us down."
Boffelli dragged an early penalty attempt wide after some sustained Argentinian pressure as Wales responded with an expansive game.
Star winger Louis Rees-Zammit was involved in three ensuing Welsh attacks, twice unable to make anything of his chip and chases and once stepping inside into space only for his offload to go forward.
Flanker Tommy Reffell showed all the skills of an outside back to step inside the Argentine defence, but Gareth Davies spilled the pass in a high-intensity opening with both sides electing to play the ball.
For all their possession, however, Los Pumas looked lacklustre when in attack and Welsh pressure paid off after George North split the defence on an inside ball from Dan Biggar.
North, making history as the first Welsh player to compete in four World Cup quarter-finals, found Davies off the floor and the scrum-half this time made no mistake to pass on to Biggar, the fly-half crossing for a try under the posts he converted himself.
Referee Jaco Peyper pinged a hamstring and was replaced by Karl Dickson as Biggar stretched Wales' lead with a 21st-minute penalty.
Biggar went wide with a long-range penalty as Wales failed to convert pressure into points, losing three of their own line-outs in quick succession, two from choosing to kick to the corner rather than for the posts.
Argentina made no mistake on their own attacking line-out, Thomas straying offside as the ball was recycled into midfield to hand Boffelli a straightforward penalty kick.
Los Pumas had the ascendancy going into half-time, Liam Williams on hand for a try-saving tackle on Santiago Carreras as Nick Tompkins fell off a tackle.
Josh Adams was penalised for a needless hit on Tomás Cubelli to allow Boffelli bring Argentina to within four points at the break when it looked at one stage like Wales could have run away with it.
Boffelli kicked a third penalty at the start of the second period as Reffell was caught offside and then took Argentina into the lead with a fourth shortly after when Dewi Lake, on at hooker for the misfiring Ryan Elias, was penalised.
Replacement scrum-half Tomos Williams reversed the momentum, dummying from the base of a ruck and scooting in under the posts, Biggar converting to make it 17-12.
A misjudged kick from Rees-Zammit put the pressure back on Wales, Argentina opting for a series of kicks to the corner.
Prop Joel Sclavi, with his first touch of the ball, was eventually driven over for a try, Boffelli converting to edge Argentina two points ahead.
Los Pumas were then penalised at the scrum, Wales kicked deep but as they threatened Williams knocked on and the ball was cleared.
North and Rio Dyer came racing back up the pitch, Matias Moroni producing a dramatic try-saving tackle on Rees-Zammit in the corner.
Legendary Pumas fly-half Nicolás Sánchez then put the icing on the cake with an interception of a Sam Costelow pass for a try, Boffelli converting.
Another veteran, hooker Agustín Creevy, snatched a turnover at the death, Boffelli making no mistake from the kicking tee with a final penalty.
Head coach Cheika played down his half-time team talk after his Pumas team twice came roaring back to stun Wales.
Argentina looked disjointed in the opening half hour, seeming unable to break down Wales's defence and slow to reorganise their own.
But two late first half penalties from winger Emiliano Boffelli kept them in the game at the break and Cheika insisted he had little to change in the dressing room.
"The first half we made two or three mistakes that cost us a lot, one was the try," said the Australian, who took his homeland to the World Cup final in 2015. "And then Wales were tactically very intelligent. They played with width, which we didn't expect. It took us two or three times to reorganise. From then on we were good in defence, apart from the error that led to their try in the second half."
Cheika insisted he was not worried, even during the opening half hour when Wales seemed to be well in control.
"I have experience in these type of games, 10-0 is a lot but momentum is what's important," added Cheika. "When you get positive momentum you can put quick points on the board and we were always in the game."
Argentina have become a completely different proposition to the team that surrendered so meekly 27-10 to 14-man England in their opening World Cup pool fixture. But Cheika insisted that was merely part of the building process.
"We knew that first game would be a bit rough and we learnt a lot because there were a lot of first-time World Cuppers in there," he said. "I don't think there has been some radical turnaround. We just built off what we learnt, tried to be a bit better at the next game."
Cheika said his team had shown one of their major qualities in that match.
"We're starting to get a bit of flow but one thing this team has always got is a lot of fight," he said. "Even in that game against England we showed a lot of fight, we just didn't handle the occasion that well."
As for whether Argentina can go all the way, Cheika acknowledged that they would not be favourites in the semi-final in Paris.
"We are just thrilled to be going to Paris, we haven't had a taste of it yet at this World Cup," he said. "We will look at tonight's game and I know we won't be favourites but we'll be giving it our best."
Captain Julián Montoya paid tribute to his team's strength of character.
"I think it comes from our personality and the way that we train," said Montoya. "Nothing has been too easy for us for the last couple of years. We trust each other. We are a very tight group."
Montoya, though, acknowledged that it had not been a perfect performance.
"We know it is not going to be perfect: life is not perfect," said the hooker. "It's how you embrace the moment and fight for each other. That's what rugby is about."
Argentina will now stay in the tournament right to the end, even if they lose their semi-final against New Zealand, with a third-place play-off awaiting the teams that fail to make the final.
"Two more weeks with this team. I don't want this to end ever," he said.