With the help of Azam and Shah's innings, Pakistan finished their first innings at 302 runs.
Australia's victory came on the back of their mammoth 589 for three declared, driven by David Warner's memorable 335 not out.
"And they kept reiterating that to me but Wadey (Matthew Wade) kept on saying at the other end let's not run too hard and run ourselves out".
Another week then separates the first Test against New Zealand from Melbourne's Boxing Day Test, before the usual tight turnaround into the last Test of the summer in Sydney.
"So when it's going through those stages, (it's) trying to control the scoreboard and we did that really well at times".
He had a near-miss off the bowling of Marnus Labuschagne on 33.
While Australia's top-order have dined out on batter-friendly wickets, they have struggled to deal with the bounce.
It was his 16th five-wicket haul and his first against Pakistan, who have lost all four Tests they have played this year after two defeats to South Africa in January.
After Australia enforced follow-on, Pakistan again got off to a poor start and were reeling at 39/3 when stumps were drawn. "But it needs to be a team effort, partnerships are important", Azhar said. "We have been beaten by a better team".
"We lacked in all three departments in both Tests but we take some positives and learnings".
At least they offered some resistance on Monday, with Masood, who models himself on England's Alastair Cook, playing some glorious strokes as he assumed a leadership role after Babar Azam and captain Azhar Ali fell cheaply on Sunday evening.
His sixth Test 50, in his 17th Test, arrived with a boundary off Lyon, his sixth four, before he chipped the spinner to mid-off where Mitchell Starc collected an easy catch.
Iftikhar Ahmed (10) failed to score big runs and was sent back to the pavilion by Starc.
He trapped Yasir Shah (13) lbw in front with a ball that skidded and sped on for 13 and went to the dinner break midway through his 25th over when Shaheen was caught at mid-off by Hazlewood.
The dinner break held up Australia's victory march but they took the second new ball shortly after the interval, allowing Josh Hazlewood to bowl Rizwan. Warner's triple century was the highlight while Labuschagne shored up his burgeoning reputation by making 162 to go with the 185 he made in the first Test at Brisbane.
In doing so, he became the oldest Pakistani to score a maiden Test century and took his average for the tour to 60.33 after the first-innings knock.