"Credit to Usman to bat an entire day against a world-class attack," Handscomb said.
"Batting with him out there was awesome. He just kept it really calm. He was very collected, very calculated. I'm sure everyone is very, very happy with the way he's gone about his game. "He never looked flustered out there."
Khawaja opened with 20-year-old Matt Renshaw (10), who survived the 12 overs before stumps on day one but was out to an outstanding, diving catch by Dean Elgar early on day two.Khawaja then shared a brief stand with Warner (11) - caught by Elgar off Kyle Abbott's bowling, just like Renshaw - before his combinations with Smith and Handscomb lifted Australia from a nervy 37-2 to 273-4.
Handscomb's dismissal, bowled by Abbott, triggered a mini-collapse of 3-10 before Khawaja and Mitch Starc (16 not out) rallied with an unbroken 24-run stand late on the second night.
Abbott (3-38) took three of the first four wickets for South Africa and Kagiso Rabada and Vernon Philander chipped in with late wickets by getting the second new ball to seam and swing under the lights.
Abbott said the pink ball wasn't swinging as prodigiously as the South Africans expected in their first day-night test match.
"We did expect it to do a lot more - I don't think it's lived up to its hype and expectation," he said. But he credited Khawaja with "batting inside his bubble" and not letting the bowling attack penetrate.
Khawaja's only real blemish was the mix up that led to the run out of his skipper Smith who, apart from a reprieve when he was dropped on 46 by Hashim Amla at slip, had been in commanding touch.
Handscomb navigated a torrid opening over from Philander and, after settling in comfortably against the old ball, plundered the same bowler for three consecutive boundaries to reach a half century.
He didn't last long against the new ball, though, and Australia quickly slipped from 273-3 to 283-6.Nic Maddinson was bowled by Rabada for a 12-ball duck on debut, and recalled wicketkeeper Matthew Wade clouted the first ball he faced for a boundary but didn't add to his score before he was bowled by Philander.
Khawaja's patience was what has been missing for the Australians on their five-test losing streak which started in Sri Lanka in July. His almost seven-hour innings contained just 12 boundaries, including the cut off Tabraiz Shamsi to raise his fifth - and most important - century in 20 tests.
The Pakistan-born batsman has been in and out of the Australia test team since his debut in 2011, but has the talent to be a long-term fixture of the top order in a rebuilding phase.
He proved he could mix it with the South African bowlers with a 97 in Perth, and repaid the faith of Australia's selectors with his longest test innings.