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.
A third try from Jesse Kriel saw the Springboks briefly take the lead before Leigh Halfpenny’s decisive penalty 12 minutes from time.
Coetzee said the result was “good for Warren (Gatland, Wales coach), but I’m not so relieved from my side”.
“They got off to a flyer, 14 points in the first 10 minutes,” the Bok coach said, highlighting Wales’ excellent exploitation of space behind a flat defence.
“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.”