The tourists bowled Sri Lanka out for 278 to leave themselves a run-chase of 94 runs in their second innings on the final day at the P Sara Oval.
Captain Andrew Strauss departed for a six-ball duck before Jonathan Trott was also dismissed, but Kevin Pietersen and Alastair Cook ensured that their side levelled the two-match series.
Spinner Graeme Swann finished with six wickets in the second innings and a haul of 10 in the match – his second in Test cricket – as England remain top of the world Test rankings.
Swann, who bowled unchanged the entire morning session, took six for 106 for match figures of 10 for 181 as he set up the victory for his side. The spinner finished with 16 wickets in the series.
Sri Lanka, who resumed at 218 for six at the start of the final day, added 60 runs for their remaining four wickets with Swann capturing two of them and Samit Patel and Steven Finn picking up one apiece.
The day began in frustrating fashion for England as they spilled two catches off Angelo Mathews, with Alastair Cook handing the batsman reprieves on three and 12 at short leg.
James Anderson's joy of trapping Sri Lanka captain Mahela Jayawardene (58) lbw was short-lived when the prolific batsman challenged the decision and TV replays showed an inside edge.
But England were undeterred and pressed hard for victory, getting their reward when Swann finally ended Jayawardene's 191-ball resistance, getting a ball to turn and bounce sharply off a good length which the batsman could only glove to a diving Cook at short leg.
Prasanna Jayawardene was also dismissed by the ebullient Swann when he was bowled around his legs for two sweeping, and Patel got into the act when he had Rangana Herath caught by Anderson at slip for two.
Mathews and number 11 Suranga Lakmal staged a valiant resistance in a 27-run last wicket partnership, but Finn finally had Mathews caught by Strauss at square leg off a miscued pull for 46.
England's run-chase got off to the worst possible start as captain Strauss was clean bowled by unlikely opening bowler Tillakaratne Dilshan for a six-ball duck.
Trott only lasted 15 balls before he too departed as Herath - who finished with an astonishing 19 wickets in the series - trapped the number three lbw for just five, and England were suddenly left looking anxious and apprehensive chasing a small target.
But Cook and Pietersen decided attack was the best form of defence as they unleashed a flurry of boundaries and played aggressively to take the tourists to their target.
Man-of-the-match Pietersen – who had bickered with Dilshan throughout the series – struck three belligerent boundaries off the spinner to win the match with a real flourish.
The victory sees England draw the series 1-1 with Graham Ford's Sri Lanka side and the result sees Andy Flower's men consolidate their status as the top-ranked Test side in the world.
England will be relieved to end what has been a gruelling winter, having lost 3-0 against Pakistan in the UAE, with West Indies providing the next challenge at home in May, before the highly-anticipated Test series with second-ranked South Africa in July.