It was a tight and fraught opening period, with the hosts going 7-3 in front at the interval through Sione Tuipulotu's try.
Noah Lolesio added another three-pointer in the second period for Australia, but the Scots upped the tempo to take the game away from the tourists.
Scotland touched down three more times via Duhan van der Merwe, Josh Bayliss and Finn Russell to take the Hopetoun Cup.
The Wallabies got a consolation score when Harry Potter slithered in but it was a disappointing afternoon for Joe Schmidt's men, who fell in the third match of their grand slam quest.
Scotland captain Sione Tuipulotu said: "We won playing our rugby, we scored some brilliant tries. It was a group effort today and that's what I'm most pleased about.
"We knew we needed a win today, nothing less. We put that pressure on ourselves and we delivered."
Tuipulotu, captaining his adopted country against the nation of his birth was given additional meaning by the presence in the crowd of his grandmother Jacqueline, who had flown over earlier this week to surprise both Sione and his brother Mosese, who featured for Scotland A against Chile on Saturday.
Jacqueline - born in Greenock - is the reason both Tuipulotu brothers are eligible to play for Scotland, and she gave her grandson a hug as he received the Hopetoun Cup post-match.
"It was an amazing moment," Sione said. "When she handed over the cup she said 'you got 'em!'
"I'm super happy and it makes the day all worthwhile, when we win like that. We won playing our rugby, we scored some brilliant tries. We know how dangerous our back three is but it was a group effort today and that's what I'm most pleased about.
"We knew we needed a win today, nothing less. We put that pressure on ourselves and we delivered."