The Southampton striker thumped home a 70th-minute header from Leighton Baines’ corner to put England in front for the first and only time at Wembley.
James Morrison had fired Scotland into an early lead with Theo Walcott equalising before the break, while a fine early second-half strike from Kenny Miller was cancelled out by Danny Welbeck before Lambert’s dramatic introduction.
Roy Hodgson handed a start to unsettled Manchester United striker Wayne Rooney and and although he sent a shot across the face of goal early on, it was Scotland who took the lead on 11 minutes.
Welbeck headed a corner away but Walcott could only clear the ball on as far as Morrison. The West Brom man’s 20-yard shot was fumbled by Joe Hart, who was slow to react.
The equaliser came just before the half-hour mark when an excellent defence-splitting pass from Cleverley down the right channel freed Walcott. The Arsenal forward cut inside Steven Whittaker and finished from five yards.
Frank Lampard replaced Jack Wilshere at the start of the second half but it was Scotland who were soon back in front.
Alan Hutton’s cross from the right was chested down by Miller, who sidestepped Gary Cahill and blasted a powerful shot thatflew past Hart.
However England were level again within four minutes when Welbeck headed Steven Gerrard’s free-kick into the bottom corner of McGregor’s net.
Rooney made way for Lambert midway through the second half and with his first touch, the Saints ace put his country in front.
He met Baines’ 70th-minute corner with a thumping header that gave McGregor no chance.
Lambert also hit the post in stoppage time as England held on to claim a narrow win over the Auld Enemy.