Media playback is not supported on this device
All the tries came in the second half with Liam Williams and Gareth Davies crossing as Wales twice opened an eight-point lead.
But Juan Martin Hernandez and Martin Landajo both scored as the Pumas refused to lie down.
Full-back Leigh Halfpenny's 78th-minute penalty edged Wales four points clear to settle the encounter.
The Toulon full-back scored 14 points with the boot, which ultimately proved the difference between the sides in a match which did not quite live up to expectations.
Read: Wales restored pride, says Howley
Howley praises 'world class' lock Jones
Following their 32-8 defeat by Australia the previous week, Wales were relieved to hang on against a Pumas side that refused to buckle in the face of extreme pressure.
After coach Rob Howley had asked for a response from his team, man of the match Alun Wyn Jones and wing Williams - who both missed the Wallabies defeat - made a huge impact on their returns.
Williams' determination for his try typified a full-blooded display by the Scarlets back.
Argentina failed to rediscover the exciting running which saw them beat Ireland at the same stadium in the 2015 World Cup.
And while Howley would be pleased with the improvement in Wales' performance, a lack of composure in attack, particularly when they were on top in the first half, will be a concern.
Wales controlled the opening period but, apart from two penalties by Halfpenny, had little to show for their dominance at the break as Argentina repeatedly infringed in their own 22.
When referee Angus Gardner finally lost patience and sent prop Ramiro Herrera to the sin-bin with a minute of the first half remaining, Wales were promptly penalised at the next scrum and went in with a three-point lead which barely reflected the run of play.
Media playback is not supported on this device
After the break, wing Williams produced a tenacious finish to edge Wales eight points clear before Landajo's opportunism from a quick penalty created a try for the superb Hernandez.
When Davies dummied over for his eighth international try and Halfpenny converted, it looked as though Wales would pull clear.
But the Pumas, with Sanchez a probing threat at fly-half, hit back again when Landajo was given the benefit of the doubt by television official Sean Davey.
An exchange of penalties meant Wales led by a point before Halfpenny eased the nerves with his fifth successful kick of the game.
Wales: Leigh Halfpenny, George North, Jonathan Davies, Scott Williams, Liam Williams, Dan Biggar, Gareth Davies; Gethin Jenkins (captain), Ken Owens, Tomas Francis, Luke Charteris, Alun Wyn Jones, Sam Warburton, Justin Tipuric, Ross Moriarty.
Replacements: Scott Baldwin, Nicky Smith, Samson Lee, Cory Hill, James King, Lloyd Williams, Gareth Anscombe, Jamie Roberts.
Argentina: Joaquin Tuculet Matias Moroni, Matias Orlando, Juan Martin Hernandez, Santiago Cordero, Nicolas Sanchez, Martin Landajo; Lucas Noguera, Agustin Creevy (captain), Ramiro Herrera, Guido Petti, Matias Alemanno, Pablo Matera, Javier Ortega Desio, Facundo Isa.
Replacements: Julian Montoya, Santiago Garcia Botta, Enrique Pieretto, Leonardo Senatore, Tomas Lezana, Tomas Cubelli, Santiago Gonzalez Iglesias, Jeronimo de la Fuente.
Referee: Angus Gardner (Aus)
Touch judges: Mike Fraser (NZ) & Luke Pearce (Eng)
TMO: Sean Davey (Eng)
Citing commissioner: Bruce Kuklinski (Canada)
Media playback is not supported on this device
Wales held on for a nervy win over Argentina in Cardiff to end a run of five successive Test match defeats.