Cardiff - Warren Gatland expressed his "relief" after seeing his Wales team sucked into an arm wrestle before edging South Africa 24-22 on Saturday.
Converted tries by Scott Williams and Hadleigh Parkes (2) had seen Wales race out to a 21-3 lead, the home side happy to torment the South African backs.
But tries by Warrick Gelant and Handre Pollard pulled the visitors right back into the game and their increased street-saviness almost saw them snatch a victory that had looked far from likely early on in the game.
A third try from Jesse Kriel saw the Springboks briefly take the lead before Leigh Halfpenny's decisive penalty 12 minutes from time.
"It's a bit of relief," said Gatland, whose team went down to Australia (29-21) and New Zealand (33-18) either side of a scrappy 13-6 win over Georgia in their autumn series.
"We started so well and looked comfortable, but the five minutes either side of half-time weren't the best periods of the game for us."
Gatland added: "We deserved that and we can be pleased with lots of things given the number of injuries we've had and the players we've blooded, the way we're tried to be positive.
"There are lots of things we can take out of this campaign in terms of developing strength in depth in the squad.
"It was pretty nailbiting, but that's what sport's about, what Test match rugby is about, and I'm pleased we came out on the right side."
Two-try hero Parkes, like Gatland a New Zealander, qualified for Wales just hours before the match, but the coach had had no hesitation about throwing him into the firing line.
"I said 'just make the most of your opportunity' and he did that," Gatland said of the pre-game advice to his countryman.
"He's carried well and defended well. He's an experienced player, we know where he's come from."
Even though it was his first cap, Gatland said he had called upon Parkes to take up a leadership role within the team boasting six Scarlets teammates.
"He's had a lot of rugby under his belt," he said. "He's done great, a fantastic pick-up for the first try and obviously a brilliant pass from Taulupe (Faletau) for the second.
"He's carried, a nice couple of kicks through. He's 100 percent he was saying in the changing room, so he's pretty happy with himself."
Under-fire South Africa coach Alister Coetzee said the result was "good for Warren, but I'm not so relieved from my side".
"They got off to a flyer, 14 points in the first 10 minutes," he said, highlighting Wales' excellent exploitation of space behind a flat defence.
"But I'm proud of the team and the way they came back," he added, lamenting Malcolm Marx's disallowed first-half try. "I thought he definitely grounded it.
"We changed our plan and we clawed our way back and won the second-half 19-3."
Coetzee was in defiant mood over criticism of South Africa's form, having gone down to record defeats by New Zealand and Ireland this calendar year.
"It's been a massive improvement from last year," he said, full of praise for his young side. "To lose in the Springbok jersey is really not ideal and we never prepare to lose a Test. I'm looking at the energy and effort players put in and the team environment is healthy.
"I would regard this year as positive," he said, with the 'Boks having lost four of their 13 Tests this year, compared to having won just four from 12 in 2016.
"You can't build Rome in a day. Last year was a fiasco... but this side is definitely on the up."