England have beaten India by 118 runs in their final test despite defiant centuries from KL Rahul and Rishabh Pant, as a series full of twists reached a compelling conclusion at the Oval.
Chasing an improbable 464 for victory, India were eventually dismissed inside the last hour on Tuesday for 345.
James Anderson took the final wicket - his 564th in test cricket, taking him past Australian great Glenn McGrath as the most successful fast bowler of all time.
The 36-year-old Anderson received a standing ovation as he walked off with Alastair Cook, England's most-capped player and record test run scorer who marked his 161st and final match on Monday with an emotional century.
They walked off to a standing ovation on Tuesday, and Anderson was close to tears as he spoke of his achievement.
"Happy that Cooky was on the field to see that wicket, it's been a tough week," said Anderson, who played the first of his 143 tests in 2003.
"I'm just happy to win the game. I wasn't even thinking about the record. When India were building that partnership it was looking like they were going to get close.
"But I got into a good rhythm and thankfully (Joe) Root let me take the new ball and gave me a chance to take that wicket."
India's spirited resistance at one point gave them an outside chance of an unimaginable consolation victory, having gone into the fifth and final test 3-1 down.
With India beginning the day on a precarious 58-3, a full day's play looked unlikely for the sparse crowd.
But shortly after tea they were motoring along at 325-5 with Rahul and Pant's partnership worth 204.
Opener Rahul, who had earlier shared a 118-run fourth-wicket partnership with Ajinkya Rahane, was eventually bowled for 149 by an Adil Rashid 'wonder ball' that pitched way outside leg stump before spinning back out of the rough and hitting off.
The 20-year-old Pant lit up a murky day with a sensational maiden century to become the first Indian wicketkeeper to score a ton in England, striking three fours off one Ben Stokes over.
He struck 19 boundaries, including four sixes in a fearless display of shot- making, but shortly after Rahul's exit he holed out trying to smash Rashid out of the ground.
With India's tail exposed England took the new ball with 18 overs remaining but it was Sam Curran, not Anderson, who struck first having Ishant Sharma caught behind for five.
Ravindra Jadeja was India's last hope, but he nicked a ball off Curran into Bairstow's clutches.
Fittingly, it was left to Anderson to apply the finishing touch and he delivered a beauty to bowl Shami, knocking his middle stump flat.
Anderson is now fourth on the all-time list of test wicket takers behind a trio of spinners; Muttiah Muralitharan (800), Shane Warne (708) and Anil Kumble (619).