The Grand Slam champions slumped to a series defeat at Loftus Versfeld but produced a vast improvement on last weekend's hiding in Bloemfontein.
Taking top billing was Williams' stunning 32nd minute try that saw the Ospreys star evade five Springbok defenders in a run that started on the 10 metre line.
Gatland said: "Shane is just absolute world class. He keeps getting better and better.
"Over the last six month he's been one of the form players in world rugby and he's proved that during the last two weeks.
"He's very accurate and strong. Even the South African fans get excited when he has the ball in his hands.
"I'm really pleased by the way he's matured into a fantastic player."
Wales assistant coach Shaun Edwards added: "Thanks God Shane plays for us and not the opposition."
The match was wide open heading into the final quarter with Wales, who earlier crossed through Gareth Cooper, leading 21-20 after weathering an early Springbok assault.
A forward surge swept them to South Africa's whitewash but referee Lyndon Bray blew for a knock-on against lock Alun-Wyn Jones - a decision that left Gatland furious.
The Kiwi said: "I'm a little bit aggrieved with a few refereeing decisions.
"We were pretty unlucky, especially under the posts when we were in front.
"When the referee says it's a knock and you can clearly see a hand in there, it's frustrating.
"If that was at the other end it would be a penalty the other way and a yellow card.
"That's something we also need to look at - we need to earn the respect of referees.
"When we're putting a team under pressure and the referee doesn't expect it, you don't get the bounce of the ball."
Late tries from Jean de Villiers and Bismarck du Plessis gave the final score a lop-sided look that was harsh on Wales as Gatland felt his players had salvaged their reputations.
He said: "I'm really proud of the performance. At 55 to 60 minutes the game was there for us to win.
"The better team won but there was a chance for us to put them under pressure and win.
"I'm very happy with the way we lifted ourselves after last week. We performed with credit today.
"Absolutely the scoreline flattered them. We missed a couple of shots at goal that at this level you must take.
"But ultimately the scoreline was irrelevant. What mattered is that we significantly improved our performance.
"We had a big chat in the changing room afterwards about where we need to go and what we need to do to compete at this level.
"I'd be happy for us to be out here for the next 10 weeks playing the Springboks because it will only make us a better side.
"This is no disrespect to the Six Nations teams but if we'd been playing any of them today we would have won.
"This is a new level for us and we think we are only going to get better."