Rickie Lambert scored with his first touch in international football as England twice came from behind to see off Scotland after a breathless encounter at Wembley.
The 31-year-old Southampton striker headed home England's winner just three minutes after replacing Wayne Rooney, to spare manager Roy Hodgson's blushes on a night when Scotland twice threatened to cause a huge upset.
Lambert's thunderous header from Leighton Baines' 70th-minute corner capped a fairytale debut for a striker who played for numerous lower-league sides and had to wait until his 30th birthday to play in English football's top flight.
But for Lambert's intervention, Hodgson may have faced some tough questions. Scotland twice took the lead as first James Morrison and then Kenny Miller took advantage of a goalkeeping error and sloppy defending respectively, before they were pegged back by goals from Theo Walcott and Danny Welbeck, to set the stage for Lambert's decisive header.
At the final whistle, all 80,000 supporters at Wembley rose to applaud after the oldest international rivals had traded blows for the first time for 14 years, in a friendly match set-up as part of the Football Association's 150th anniversary celebrations.
From an England standpoint, this may not have been the convincing victory that Hodgson wanted ahead of key World Cup qualifiers against Moldova and Ukraine early next month, but this was as exhaustive an examination as he could have hoped for.
The contest was committed and competitive. There were encouraging signs from the midfield trio of Tom Cleverley, Jack Wilshere and Steven Gerrard, while the flair and fortitude of Welbeck and Lambert will have offered encouragement ahead of four matches that will decide whether England go to next summer's World Cup in Brazil.
Even in defeat, Scotland were impressive and this performance will add to their growing optimism under the leadership of Gordon Strachan. The performances of Morrison and James Forrest caught the eye, while Scott Brown led with a calm assurance.
The build-up had been dominated by Wayne Rooney and the uncertainty around his future at Manchester United. With the exception of a 45-minute appearance in a behind-closed-doors practice game against Real Betis 10 days ago, this was his first meaningful run-out since he scored in England's 2-2 draw against Brazil on 2 June. But this was not to be his night.
The 27-year-old striker was wrongly ruled offside on the stroke of half-time, as he latched on to Steven Gerrard's pass and fired in. Rooney looked a footballer desperate to prove a point - demanding the ball, launching himself into challenges and shooting on sight. He left the field to a standing ovation from the England fans, but it was his replacement who would steal the headlines.
It had been Rooney who had England's first chance, when he flicked Baines' fizzing low cross wide. But it was Scotland who landed the first blow.
Miller's tireless running won a corner, which was cleared only as far as West Brom midfielder Morrison, who unleashed a fearsome shot through a crowd of English defenders - one that crept beyond Manchester City goalkeeper Hart, who should have done much better.
Scotland redoubled their efforts and Grant Hanley suffered a head injury as he attempted to keep England at bay. With the Blackburn defender temporarily off the field receiving treatment, England equalised with the first half's single moment of brilliance.
Cleverley released Walcott down the right with a delightful pass. The Arsenal forward raced into the area, cut inside Steven Whittaker and prodded a left-foot shot beyond McGregor.
Scotland found new purpose as the second half began, and were soon back in front. Miller gathered Alan Hutton's clever cross and lost Gary Cahill with a drop of the shoulder, before turning on to his left foot and drilling a shot beyond Hart.
England had to respond quickly and they did. Gerrard whipped a free-kick into the penalty area, where Welbeck rose above Martin to head forcefully beyond McGregor.
Hodgson's side took control after that, and the pressure told. Leighton Baines curled a corner into the danger area, where Lambert, on as a substitute just two minutes earlier, thundered a header into the net.