It took an injury-time tackle from New Zealand fly-half Beauden Barrett on Scotland's flying full-back Stuart Hogg to deny a dogged Scotland the chance of an historic victory against the All Blacks on Saturday.
A converted 76th-minute try from centre Huw Jones had put the Scots within five points of the visitors and another converted try would have secured their first ever triumph against the men in black.
As it was, second-half tries from hooker Codie Taylor, full back Damian McKenzie and Barrett, plus two conversions and a penalty from Barrett proved enough to win 22-17 and preserve the All Blacks' unbeaten record against Scotland, who were level 3-3 at the interval.
Scotland head coach Gregor Townsend acknowledged the challenge of beating the back-to-back world champions as "the ultimate test" but urged his players to impose themselves from the start.
They had an excellent chance to lay down an early marker but lost possession from a catch and drive and then prop Darryl Marfo spilled the ball when Hogg launched a potentially threatening attack.
Still, the home side were rewarded for their endeavour when Russell landed his first penalty attempt to give them a 3-0 lead after six minutes.
They might have doubled the advantage seven minutes later but Russell pushed wide a long-range penalty.
Russell went for a line out drive rather than the posts with the next Scottish penalty award but, after the forwards had driven to within five metres of the line, centre Jones dropped the ball as it was shipped wide.
- A try from nothing -
It took the All Blacks 20 minutes to get into the Scotland 22. They got perilously close to the home whitewash but lock Sam Whitelock, and then centre Ryan Crotty, were thwarted by the resolute home defence.
New Zealand were fortunate to still have 15 men on the field when Hogg was tackled in the air by the big Highlanders wing Waisake Naholo.
After consulting TMO David Grashoff, however, referee Matthew Carley decided the offence was worthy only of a penalty, as Scotland scrum-half Ali Price had been in between the two players when the All Black made his move to engage in the tackle.
Barrett stepped up to kick a 38th minute penalty to tie the half-time scores at 3-3.
Scotland began the second half on front foot with centre Alex Dunbar stopped a metre or two short of the try line. But after 44 minutes Townsend?s team found themselves behind.
The All Blacks conjured a try from nothing, Taylor taking a long, looping pass from Barrett to finish a simple overlap on the left, the Crusaders hooker having launched the attack himself.
Barrett was off target with the conversion but made amends seven minutes later.
Scotland were getting to grips with a re-shuffle of their forwards at the time after replacement prop George Turner had to shift to the blindside flank when Luke Hamilton ?- himself a replacement for the injured openside flanker Hamish Watson -? was forced to depart.
The All Blacks had them backpedalling from a lineout drive and centre Sonny Bill Williams dinked a grubber kick through for McKenzie to score.
Barrett?s conversion made it 15-3 but Scotland turned the tide. The All Blacks were reduced to 14 men on the hour mark when persistent infringing close to the line prompted a yellow card for flanker Sam Cane.
A minute later Gray scored from a close range ruck and Russell converted, pulling the score back to 15-10.
But then, after 66 minutes, Williams punched a hole up the middle, slipped the ball out of the back of his hand to McKenzie and the full back fed in Barrett for a try on the right. The fly-half converted and the world champions had a 22-10 cushion.
Just as Cane returned to the field, replacement prop Wyatt Crockett departed to the sin bin and, once again the Scots fought back.
Four minutes from time Hogg threated a grubber kick through for centre Jones to score, Russell's conversion making it 22-17.
© 2017 AFP