Duncan Weir kicked a penalty in the second last minute to secure a 19-21 victory over Argentina in Cordoba on Friday.
The result means that Scotland will head to Port Elizabeth where they will face South Africa's Springboks unbeaten under new coach Vern Cotter.
Scotland were trailing 19-13 in the final stages but Henry Pyrgos scored in the 74th minute. The conversion was missed but then Weir kicked the Weir kicked 79th minute penalty goal to give Scotland the win.
The match was Scotland's third on tour this month after tight victories over the USA and Canada.
Speaking after the match Cotter said that he was pleased with the way they dug deep at the end of the match.
"It was a tough game and we had to find the resources at the end to come back and win," said Cotter.
Final Score Argentina 19 (8) Scotland 21 (7)
Tries - Ortega Desio, Tuculet
Pen -Sanchez (2)
Drop - Sanchez
Tries - Hogg, Pyrgos
Pen - Weir (3)
Con - Weir
Referee : John Lacey (Ireland)
15 Stuart Hogg, 14 Sean Maitland, 13 Nick De Luca, 12 Peter Horne, 11 Tommy Seymour, 10 Duncan Weir, 9 Grayson Hart, 8 Kieran Low, 7 Blair Cowan, 6 Rob Harley, 5 Grant Gilchrist (c), 4 Jonny Gray, 3 Geoff Cross, 2 Ross Ford, 1 Al Dickinson.
Replacements: 16 Pat MacArthur, 17 Gordon Reid, 18 Jon Welsh, 19 Tim Swinson, 20 Chris Fusaro, 21 Henry Pyrgos, 22 Tom Heathcote, 23 Dougie Fife.