Sri Lanka 183 (Mathews 64, Chandimal 59, Ashwin 6-46) and 367 (Chandimal 162, Mubarak 49, Thirimanne 44, Ashwin 4-114) beat India 375 (Dhawan 134, Kohli 103, Saha 60, Kaushal 5-40) and 112 (Herath 7-48, Kaushal 3-47) by 63 runs
After having made 377 look like 150 against Pakistan recently, Sri Lanka were back to their old ways of making sub-200 targets appear 350-plus by choking the life out of India's chase.
Their bowlers had failed to build any pressure in the first innings, but they hardly released it on the fourth day.
India needed 153 to win with nine wickets in hand at the start of the day, but Rangana Herath and Tharindu Kaushal bowled them out to complete a sensational win.
Not counting the forfeiture of The Oval Test in 2006, this 192 was the eighth highest first-innings deficit turned around into a Test win.
Dropped in the last match and lacking the bite in the first innings, Herath put more body into the ball, bowled hardly a bad ball in 21 overs, went past Bishan Bedi to become the third-most successful left-arm spinner in Test history, and registered the second-best figures in Galle.
This was a return to what Sri Lanka do really well: runs to play with, in-and-out fields so they are both attacking and defending at the same time, and their spinners landing everything on a penny.
The Galle International Stadium is an open venue with few stands in a sparsely populated city, but India would have felt there was no air to breathe on the fourth day.
A day earlier they were almost certain of a win, but a turnaround began their inexplicable resistance to DRS and an excellent counterattack by Dinesh Chandimal.
If that turnaround was unexpected, on the final day it was predictable that Sri Lanka would make India work hard for every run on a turning pitch.
Eventually India did not work hard enough, in terms of applying themselves technically, folding for their lowest total against Sri Lanka.
Working extremely hard was a 37-year-old portly spinner, fighting sore knees and a dodgy back, realising he needed to spin the ball harder to make a helpful pitch respond to him.
And he did so emphatically. Having taken out KL Rahul on day three, Herath removed nightwatchman Ishant Sharma with the first ball he bowled in the morning.
In an 18-over spell that followed, either side of lunch, he bowled just two half-volleys, one short ball and taking six wickets for just 35 runs.
In the face of Herath's unerring accuracy, the India batsmen seemed to overplay the threat of the arm ball, either staying leg side of the ball or pushing out in front of the pad.
Herath still managed to produce a wicket each of four kinds: Ishant Sharma was out lbw although he might have been hit outside the line, Rohit Sharma was bowled staying beside the line of the ball,
Wriddhiman Saha was stumped when beaten by one that dipped on him and ripped past him, Harbhajan Singh sensationally caught pad-bat,
R Ashwin caught at mid-on in a desperate attempt to break the shackles, and finally Ajinkya Rahane through an edge to slip to end India's final resistance.
Credit was also due to Dhammika Prasad and Nuwan Pradeep, who tested the overnight batsmen thoroughly.
Ishant, the nightwatchman, was dropped at second slip in Pradeep's first over, but Pradeep's bigger impact was in beating the first-innings centurion Shikhar Dhawan outside off on three occasions with balls that held their line.
Dhawan, batting with a bruised hand, went to discipline over bravado. With Ishant as the other batsman, runs hardly came.
Dhawan was exemplary in avoiding temptation, taking 36 balls to add to his overnight score of 13. Anything wide outside off he didn't go after, and the quicks didn't offer him anything on the pads.
Shikhar was in a way the rock of the collapsing innings, but there could be a counter argument to playing yourself into a shell.
After Herath got rid of Ishant with his first ball of the day, Rohit didn't get to face a bowler other than Herath.
It can be argued that had Dhawan been more urgent he could have possibly opened up the easier end for Rohit.
That, though, is no excuse for having your front foot outside leg when playing a forward-defensive to a ball pitching on middle and turning to off.
Nor does it absolve Virat Kohli, still looking for a win as a captain, of a rookie mistake of playing an offbreak well in front of his body with hard hands.
When he did that to the last ball of the first over bowled by Tharindu Kaushal, he offered Kaushal Silva a sharp catch at short leg, and gave the error-prone Kaushal just the start he needed.
At 45 for 4, the pressure became unbearable for India. Even though Ajinkya Rahane looked solid and India still needed only 122, Dhawan became edgy after all the hard work in the first hour.
In the 20th over the day, he shaped up to reverse-sweep Kaushal, saw the ball was not there, looked for a regulation sweep, and in the end patted it back.
The next ball he managed a leading edge on a leg-side half-volley to give Kaushal a sharp return catch. That is the risk you always run when you defend for so long without scoring many runs.
India's last recognised pair was in with 116 still required. And Herath was in no mood to offer easy runs.
Even when Rahane got shots away, the trademark Sri Lankan in-and-out field meant he didn't get boundaries.
And then Herath produced a gem for Saha, dragging him out with a flighted delivery, and getting it to turn and bounce alarmingly.
Dinesh Chandimal, the man responsible for making India bat again, made a good rib-high collection and stumped Saha.
The best piece of fielding, though, was reserved for the last wicket of the first session, a wicket that betrayed India's muddled thinking.
When Harbhajan was promoted ahead of Ashwin, you would have thought he would have been asked to pinch-hit and see if India could knock Sri Lanka off their rhythm.
Harbhajan, though, failed to play a shot in anger and was caught superbly diving forward by Silva off a tame forward-defensive stroke.
After lunch Ashwin tried to do what Harbhajan should have done, but fell to an unusually wide mid-on, another example of how it seems there are more than 11 fielders on the field when you are struggling.
Rahane and Amit Mishra then added 21 in what was not only the highest but the most assured partnership of the innings. Herath finally got one on target to turn and take Rahane's edge, and with 74 runs still required it was only going to be a matter of time.