Springbok coach Heyneke Meyer says he took plenty of positives from his side's unconvincing 30-17 victory over Scotland at the Mbombela Stadium in Nelspruit on Saturday.
"Last year we probably would have lost these kind of games'so I thought the guys learnt a lot from this. To win 30-17 after being down 17-3, they showed a lot of character," Meyer said.
"I am obviously not happy with the first half but I thought we needed a game like this before we go into the championships. This team is still evolving and there are a lot of exciting players but you need to win games like this where you just grind out a win."
The hosts would now play against Samoa in the final of the four-nation series in Pretoria next weekend.
At the start of the match, the South Africans were surprised by a much-improved performance from Scotland who tested their defence.
Meyer said he was not satisfied with his team's performance at the breakdowns, and they would have to look at the reasons why they could not get quick ball from this area of play.
"We always knew we had to adapt to Northern Hemisphere referees and the way they play the breakdown," Meyer said.
"It was very frustrating at times, probably sometimes guys not rolling away but all credit to Scotland.
"It is frustrating if you know you have the backs and you want to play exciting rugby but you don't get quick ball."
The Scots were rewarded for their spirited assaults on the gain line, coming away with the first points of the match as captain Greig Laidlaw succeeded with a penalty in the seventh minute.
Laidlaw, playing in his first Test as captain, was damaging around the fringes and caught the South Africans sleeping.
Springbok flyhalf Morne Steyn levelled the scores in the 13th minute and added another three points five minutes later to put South Africa in the lead.
It was short-lived as Scotland pierced the Springboks' defence on the 20-minute mark with centre Matt Scott finding easy passage past the South African defenders to score, with Laidlaw converting.
While the Scots were threatening on attack, the hosts were rather toothless and they looked generally disjointed.
As the teams went into the change rooms for the half-time break, Scotland held on to a four-point advantage over the Springboks.
Scotland struck another psychological blow shortly after the restart as outside centre Alex Dunbar touched down in the 43rd minute. Laidlaw converted to extend his team's lead to 11 points.
The Boks' fortunes started to turn in the 49th minute when referee Roman Poite awarded a penalty try against Scotland for collapsing a maul near the try line, with Steyn converting.
Poite's whistle again favoured the Boks three minutes later when Scotland lock Jim Hamilton was yellow-carded for taking a swipe at Eben Etzebeth.
South Africa took full advantage of having an extra man with JJ Engelbrecht scoring his five-pointer in the 55th minute.
Fullback Willie le Roux showed his worth as he pulled in defence and gave a well-weighted pass to Engelbrecht to finish, with Steyn converting to give South Africa a three-point lead.
Substitute Pat Lambie opened his account in the 75th minute with a penalty conversion to take South Africa's score to 23-17.
The Boks finished the match with a final flourish as Jan Serfontein, playing off the bench, scored his team's third five-pointer of the evening. Lambie converted for a flattering final score of 30-17.