Wales, emboldened by its historic win over the Springboks in Bloemfontein last weekend, did close it to 10-5 midway through the first half with its only try by impressive flanker Tommy Reffell. He was on hand to take a pass after winger Josh Adams was dragged down just short.
But the world champions relied on their power game to get it done as both teams had to adjust to early injuries. Wales No. 8 Taulupe Faletau was a late withdrawal and flanker Dan Lydiate went off with a head injury, and Springboks winger Cheslin Kolbe had a suspected broken jaw, forcing the home team into a backline shuffle that left center Lukhanyo Am to play wing for the rest of the game.
South Africa launched most of its attacks up the middle anyway.
The forwards softened the Welsh defense enough for Pollard to score the first try in the 14th and a 10-0 lead.
Wales' reply through Reffell, who was playing his debut series, came just five minutes later.
But Wales gave away a bunch of penalties early on — eight of the first nine awarded in the test — and South Africa made it count when Mbonambi split from a maul just before halftime to extend the gap to 17-8 with a try in his 50th test.
Wales again came back to make it 17-14 through the boot of captain Dan Biggar.
Kolisi burst over in the 53rd after the Springboks wore the Welsh down by sending their big ball carriers at the opposition off a series of rucks. The home team was in control from there and Pollard kicked two late penalties, the last one on the fulltime hooter, to widen the margin.
"In that last 20-25 minutes they squeezed us and we couldn't get a foothold in the game," Biggar said. "Even though we had a couple of chances, against a top team like this you've got to take them. Disappointed but very proud overall."
South Africa started the series as the top-ranked team in the world but has slipped to third after the shock loss in the second test. The Springboks have back-to-back home tests next month against the All Blacks, who are stinging from their 2-1 series loss to Ireland.
"Its been a tough series," Kolisi said. "I think it's exactly what we needed to start our season."