On an enthralling day when 15 wickets fell, England's frontline spinners came to the fore and opener Dom Sibley scored an unbeaten half-century to help defeat Sri Lanka by six wickets with a day to spare and win the series 2-0.
Lasith Embuldeniya followed his 7 for 137 in the first innings with 3 for 73 to take 10 for the match - not to mention top-scoring in Sri Lanka's second innings - but it was not enough as Sibley, in need of runs, played exactly the innings that was required of him: patient, productive and at times fortunate.
Going into the final session on day four, the tourists still needed 118 runs and they got there via an unbroken 75-run partnership between Sibley and Jos Buttler, who followed his 55 in the first innings, where he played a fine supporting role as Joe Root scored his wonderful 186, with 46 not out. Sibley hit the winning run to end unbeaten on 56.
Earlier, England extracted the performance they required from spinners Dom Bess and Jack Leach - just about - although it fell to Root to plug the gap, his part-time spin breaking stubborn resistance from Sri Lanka's tail to contain the hosts' lead to 163.
Sri Lanka held a 37-run first-innings advantage after claiming England's last wicket with the 11th ball of the morning. But they collapsed to 78 for 8 at the hands of Bess and Leach, who took four wickets each, in a display that rivalled their 135 all out in the first innings of the first Test for impotence.
An excellent rearguard by Embuldeniya and Suranga Lakmal posed some danger on a pitch where Embuldeniya had already proved effective in England's first innings, prompting Root to bring himself into the attack and he took two in two balls to finish Sri Lanka off.
By tea, Embuldeniya had claimed an eighth wicket for the match when he dismissed Zak Crawley for the fourth time this series, caught at gully for 13. It was the first time Crawley had reached double figures in the two Tests.
Fellow opener Sibley survived three reviews for lbw on umpire's call, first off Embuldeniya - who had him out three times up to that point - and then off Dilruwan Perera and Ramesh Mendis. Coming off scores of 4, 2 and 0 in the series, Sibley capitalised on his reprieves and found a way to hold the innings together after Embuldeniya dismissed Jonny Bairstow and Dan Lawrence to leave England on a nervy 89 for 4.
Root was back at the crease seemingly moments after his brilliant display in England's first innings, but he was denied the chance to see his side home when, perhaps still feeling the effects of the exertion which saw him cramping severely on the third evening, he was bowled round his legs by Mendis for 11.
From there, Sibley and Buttler got the job done, Buttler surviving on 18 when he sent a sharp return catch to Mendis, who couldn't hold on diving left on his follow-through.
Wicketless in Sri Lanka's first innings when England's seamers - namely James Anderson - dominated, Leach and Bess found their range and plenty of turn to reduce the home side to 67 for 6 at lunch.
Leach entered in the sixth over, immediately after Bess, and struck with his second ball, coming round the wicket to Kusal Perera, who dropped to one knee shaping to slog-sweep and was struck in line with middle stump. A review found the ball to be clipping the bails, umpire's call.
Crawley claimed three catches at short leg as the Sri Lanka batsmen appeared spooked by the way England's spinners were now making the most of the deteriorating Galle pitch. Bess removed the threat of Angelo Mathews, Sri Lanka's first-innings centurion, for just 5 with a full ball that spun sharply and clattered into off stump as Mathews attempted to sweep.
It was an excellent running catch by Anderson that accounted for Dinesh Chandimal, who attacked Leach and sent a top edge in the direction of mid-on where Anderson had to move deeper at speed while turning more than once to follow the flight of the ball, which seemed to take an eternity to drop over his shoulder and into his hands.
In a reversal of fortunes that made Buttler's freak dismissal on the third day look less bizarre, he and Leach combined to remove debutant allrounder Mendis in similar fashion when Mendis, attempting to sweep, bottom-edged the ball onto his boot and was caught behind.
With Root off the field it fell to Buttler, England's vice-captain and wicketkeeper, to decide whether to use their remaining review when Mendis was initially adjudged not out. Buttler took the chance, confident of a dismissal which was a near copy of his own the previous day when he was caught at short leg off Mendis, and he was proved right.
But Embuldeniya, so damaging with the ball, countered on the way to his highest first-class score. He helped himself to a six off Leach over long-off and slog-swept Bess for four to frustrate England's efforts.
Root brought himself on in a bid to break his union with Lakmal and almost did when Embuldeniya, on 39, edged to slip where Bairstow grasped at a fast-moving chance but couldn't hold it. Bairstow made no mistake in Root's next over, however, as Embuldeniya poked a fuller delivery straight into his hands.
Root then had Asitha Fernando out with his next ball, a wider delivery that the batsman managed to drag back on to his stumps.
England next head to India, where they will likely face sterner opposition from the side who recently toppled Australia, but they wil