Scotland edged a taut contest to claim a third consecutive victory over Australia and continue their winning start to the Autumn Nations Series.
Hamish Watson's well-worked score gave Gregor Townsend's side an interval lead, but Dave Rennie's tourists - on a five-game winning streak - led after Rob Leota's incisive burst.
Debutant Ewan Ashman restored the Scots' advantage with a stunning finish and, although James O'Connor kicked Australia back in front, Finn Russell slotted the decisive penalty.
That made it consecutive wins for Scotland after last week's 60-14 canter over Tonga and sets them up for next Saturday's visit of world champions South Africa.
The expectations ahead of this one were not just sky high, they were in a different stratosphere.
We did not get the buckets of tries we expected but we got a thriller in the shape of a slow burner, a game that started slowly but ended with Murrayfield in raptures in acclamation of another huge moment for this team.
There was a stop-start nature to it early on, but those are distant memories. It threatened to catch fire with a Darcy Graham break or a Stuart Hogg scamper or an audacious Russell offload but things did not stick.
The mindset was to play fast and furious, but the lack of accuracy did not allow it. Or enough of it. The drama came in the end, though. Boy, did it come.
Australia could - and should - have taken an early lead but O'Connor blasted his penalty wide. For a player trying desperately to convince his coach to give him the 10 jersey ahead of the absent Quade Cooper, it was an uncomfortable moment.
George Turner had one of those, too. The hooker had to leave the field through injury after just 11 minutes. On came Ashman for his debut.
His first job - a scrum, followed by a Wallaby scrum penalty. Welcome to the harsh reality of big-time rugby. Ashman, to his great credit, went on to play terrifically well. Even before his magnificent try he was having a stormer.
The passage of play that encapsulated the chaotic state of the game in the first half came after 15 minutes, when Hogg ate up ground down the left, leaving a Wallaby as roadkill behind him. Ali Price ran in support, then Duhan van der Merwe.
The Scots ended up with a 5m line-out. Promising. Then they made a hash of it as they spread it wide. The Wallabies hacked downfield and turned defence into attack. A few moments after launching an attack down one end, Hogg was frantically trying to deal with a loose ball down the other.
Scrum Australia. Promising, again, if only until Hamish Watson - playing majestically again but that is no shock - turned it over under his own posts. That was a big moment and he had another soon after.
Scotland could have taken an easy three points close to the half-hour but went for touch instead. Good call. Jamie Ritchie took the ball, Grant Gilchrist came in a second wave and Watson got on the end of it.
Romain Poite, refereeing for the final time in long career on the whistle, checked for obstruction but the score stood. Russell put over the conversion to make it 7-0.
Composure and talent sees Scots through
Australia, reborn under Rennie, were going for their sixth win in a row, and we saw the first stirrings from them when Jordan Petaia went over in the corner - play was called back - and when the great Michael Hooper barrelled over under the posts. That was called back, too.
In the build-up, Allan Alaalatoa entered a ruck in a pretty dangerous way, not quite catching Matt Fagerson in the head but going too close for Poite's liking. Hooper's try was chalked off and the loose-head was binned. A lucky escape for the Scots.
O'Connor narrowed the gap just before the break and, finally, the visitors made a chance stick early in the new half.
New cap Izaia Perese found a soft shoulder to start it all before Leota thundered through Pierre Schoeman and Sam Skinner to score. O'Connor made it 10-7. Now, we had a game. A belter.
Scotland's resolve was outstanding. They drove hard at the Wallabies, whose defence was brutally tough. They drove again and again. Russell launched a 50-22 beauty and Scotland were back in Aussie territory.
What happened in these minutes was redolent of the endgame in Paris in the spring, the cool-headed execution that saw Scotland earn a Six Nations win at the death. This was a lot earlier but the belief was the same.
Van der Merwe must have thought he was in again but Nic White did brilliantly to keep him out. Penalty followed penalty. Russell threw a sublime offload to Grant Gilchrist close-in but still the visitors held out - and still the hosts stayed calm.
Off another scrum in the left corner they attacked the short side, Schoeman finding Ashman, a loose-head to a hooker, who took Perese's tackle before touching down wondrously. It was the finish of a world-class wing, not a replacement hooker making his debut.
Russell narrowly missed the conversion and that was sore because O'Connor put over a penalty with 15 minutes left to inch the Wallabies back into the lead. A point in it.
The pendulum swung again. A fourth penalty against the Wallaby scrum - Hooper smiled the most sarcastic smile Poite may have ever seen - and Russell lashed it over nervelessly.
From Australia by two, to Scotland by two, to Australia by one and now Scotland by two again.
And, gloriously, for Townsend's team, that's how it ended. They saw it out with the composure of a side that has more talent and nous than any Scotland team that has gone before them in 20 years.
England, France and Australia all beaten in 2021. Roll on South Africa next week, roll on the Six Nations in 2022. Roll on.
'There was a fire about us'- reaction
Scotland head coach Gregor Townsend told Amazon Prime: "In the coaching box, we were a bit emotional at the end. It wasn't the best of games, but the resolve the players showed and the impact the bench made was tremendous.
"At half-time we knew we hadn't played our best rugby, but there was a fire about us in that second half which was great to see, and there was an edge to our set-piece."
Scotland captain Stuart Hogg told Amazon Prime: "That was brilliant, I loved it. How good was it to have a full Murrayfield?
"I said to the boys that the job's only half done. We're two games in with two wins, and it's about backing it up next week. The exciting thing is that we can get better both at set-piece and in open play."
Match stats
Scotland: Hogg, Graham, Harris, Johnson, Van der Merwe, Russell, Price, Schoeman, Turner, Z Fagerson, Skinner, Gilchrist, Ritchie, Watson, M Fagerson.
Replacements: Ashman, Bhatti, Kebble, Hodgson, Bayliss, Horne, Hastings, Steyn.
Australia: Kellaway, Wright, Ikitau, Paisami, Petaia, O'Connor, White, Slipper, Fainga'a, Alaalatoa, Arnold, Rodda, Leota, Hooper, Valetini.
Replacements: McInerney, Bell, Tupou, Skelton, Samu, McDermott, Beale, Perese.
Referee: Romain Poite