Set 317 for victory, the visitors put up a stellar fight as they chased their first Test triumph in Australia since 1995.
AS IT HAPPENED
But they were dismissed for 237, with the last five wickets falling for 18 runs.
Australian skipper Cummins was the chief destroyer, taking 5-49 to go with his first innings 5-48 — only the second 10-wicket haul of his Test career.
Mitchell Starc chipped in with 4-55 as the tail collapsed after Shan Masood (60), Agha Salman (50) and Babar Azam (41) gave them a fighting chance.
“Little bit twitchy, felt okay but they were batting pretty nicely,” said Cummins.
“Anything with a three in front of it was the aim, so we got that,” he added of the target they wanted to set Pakistan. “Felt like we had enough to bowl at but a little bit tight.”
It was always going to be a tough task, with the highest-ever successful fourth innings run chase at the Melbourne Cricket Ground the 332-7 England managed in 1928, with no other team getting past 300.
“We have to look at the bigger picture. The smiles are that there are a lot of positives,” said Pakistan captain Masood.
“This is the way we want to play Test cricket, fighting until the end and a result was possible for us. A lot to work on. But this is a blueprint.”
Opener Abdullah Shafique departed for four during a tricky session before lunch, caught by Usman Khawaja in the slips off Starc following a period of intense pressure.
Imam-ul-Haq survived the initial blitz, but was no match for Cummins after the break, with the pacer sending down a probing ball that nipped back and trapped him lbw for 12.
Masood was given out lbw by the umpire on 12, but it was overturned on review and he quickly got back in his stride.
He took a nasty ball to the ribs that needed treatment, but was undeterred and raced to a gutsy 50 before Cummins again came to Australia’s rescue, enticing an edge to Steve Smith.
There was plenty resting on the shoulders of Azam as the side’s premier batter and he looked in good nick.
But after reaching 41, Josh Hazlewood got a ball to jag back and it clattered into his off stump.
Mohammad Rizwan also looked dangerous on his way to 35 before Cummins again worked his magic, with Alex Carey collecting a catch behind the stumps after the ball went off the batsman’s glove.
Cummins then removed Aamer Jamal and Shaheen Shah Afridi in quick succession before Starc cleaned up.
The Pakistanis padded up after the hosts were all out in their second innings for 262, after resuming on 187-6.
Mir Hamza was the best of the bowlers with 4-32, while Afridi took 4-76.
Carey slammed 53 to help Australia build their overnight lead.
He resumed on 16 after Australia had bounced back from 16-4 thanks to an attacking 96 from Mitchell Marsh and Smith’s gutsy 50.
Carey, who made his first and only Test hundred in Melbourne a year ago, hit consecutive fours in his first over off Hasan Ali to build confidence.
At the other end, Starc lived dangerously and fell for nine with the impressive Afridi getting the breakthrough on a pitch still offering a bit for the bowlers.
Azam took the sharp chance at slip after Starc miscued a drive.
Cummins made a breezy 16 but was caught behind by Rizwan off Jamal, who then bowled Lyon for 11, with Carey the last man out, lbw to Hamza.
The final Test of the three-match series is in Sydney next week.