Rangana Herath ripped through India with seven wickets as Sri Lanka completed a stunning comeback to win the first Test at Galle.

The hosts had trailed by 192 runs after the first innings and were staring at a potential innings defeat at five for three in their second.

But after Dinesh Chandimal's unbeaten 162 gave them something to bowl at, Herath took seven for 48 and fellow spinner Tharindu Kaushal three for 47 as India were bowled out for 112 to lose by 63 runs.

The tourists resumed on 23 for one, needing another 153. After six overs of seam to start the day Herath was introduced and struck with his first ball, nightwatchman Ishant Sharma trapped lbw for 10.

Rohit Sharma was next to go as Herath ripped one past his defences to strike the top of off stump, and Kaushal got in on the act when Kaushal Silva dived forward at short leg to brilliantly catch Virat Kohli for three.

Shikhar Dhawan had been unusually becalmed as he watched things unravel at the other end and when he fell for 28, Kaushal racing to the adjacent strip and diving to take a superb return catch, India were 60 for five.

Herath had Wriddiman Saha stumped and Harbhajan Singh caught by Silva - another brilliant reaction take by the close fielder - to claim his 22nd five-wicket haul in Tests.

That was 67 for seven with Ajinkya Rahane settling into a similar role to Dhawan before him, and he and R Ashwin attempted to dig in until the latter chipped Herath to Dhammika Prasad at mid-on - the new-ball bowler probably glad to be back in the action after being given only four overs in the innings.

Rahane reached 36 - the top score of the innings - before becoming Herath's final victim when he edged to Angelo Mathews at slip.

It was left to Kaushal to wrap things up with the help of another high-class catch close in, Dimuth Karunaratne back-tracking from silly point to take a looping bat-pad offering from Amit Mishra.

The ecstatic Sri Lankans lifted Kumar Sangakkara, playing his penultimate Test before retirement, onto their shoulders for a lap of honour as the crowd paid tribute to the great batsman.

Captain Mathews said at the post-match presentation: "What a turnaround. I am speechless, great effort.

"It was a poor batting performance in the first innings, but we came back. Chandimal was outstanding - he single-handedly got us to a fighting score.

"The wicket was pretty demanding. We were down and out for three and a half days. We have good-quality spinners and the wicket was turning quite a lot."