Agar nearly had a second hat trick when he took two in two balls later on. The left-arm spinner finished with brilliant figures of 5-24 as South Africa crumbled to 89 all out — its lowest T20 total — in reply to Australia's 196-6.
"All round, a pretty good performance," Australia captain Aaron Finch said.
Much was made of Australia's return two years on from the cheating episode in a test in Cape Town that saw Steve Smith and David Warner banned for a year, and Smith lose the captaincy, in one of cricket's biggest scandals of recent times.
Smith and Warner both played in the game at the Wanderers on Friday night and Australia was unaffected by what had been a tense buildup in a supremely efficient victory.Cameron Bancroft, the other player involved in the tampering plot, is not on this tour.
The CEO of South African cricket had called for fans to show respect to the Australians amid concerns the animosity of the 2018 series would re-emerge. The South African fans never got on top of the Australians. They weren't allowed to because of the dominance of the tourists.
There were references to the scandal around the ground, though.
One sign held up by a fan read: "Sandpaper for Sale!!! Pocket-sized for extra discreetness."
In 2018, Bancroft was caught illegally tampering with the ball using a piece of sandpaper, which he tried to hide first in his pocket and then down the front of his trousers. Warner had come up with the plan to cheat and Smith knew about it and allowed it to go ahead.
On Friday, Warner was out for 4 on the second ball of the game in a dramatic start. But after that Australia silenced the normally boisterous and occasionally hostile crowd at the Wanderers.
Smith made 45 off 32 balls to top score for Australia. Finch made 42 and Agar also contributed with the bat with 20 off just nine balls.
The Aussies were especially rampant with the ball.
Mitchell Starc removed South Africa captain Quinton de Kockon the third ball of the South African innings with a fast, swinging delivery that knocked out the middle stump.
South Africa was already struggling badly at 44-4 when Agar took his hat trick in his first over into the attack.That 44-4 rapidly became 44-7.
Agar had Faf du Plessis (24) caught on the cover boundary off his fourth ball. Andile Phehlukwayo was out lbw next ball and failed with a DRS review. Dale Steyn edged to skipper Finch at slip to complete the hat trick.
Finch sprinted away after the reflex catch and celebrated with a leaping high-five with Agar.
"A highlight of my cricketing life," Agar said.
"It's funny. I was actually feeling horrible leading into he game. I don't know. Just that self belief at the top of the mark to let it all out and give it your best go ... you get on a roll and you keep going."
Agar's hat trick was the 13th in T20 internationals and he's the second Australian man to do it. Former Aussie fast bowler Brett Lee took the first hat trick in T20s in 2007.
The three-game T20 series moves on to Port Elizabeth on Sunday and then Cape Town, the scene of the tampering scandal, for the final game.