Ashwin (5-42) and his spin colleague Amit Mishra (3-29) ran through the Sri Lankan batting order as the hosts, chasing 413 for an improbable victory, collapsed to 134 all out in their second innings.
Resuming on 72-2, Sri Lanka lost skipper Angelo Mathews to the first ball of the day, a setback that completely unhinged them and they collapsed soon after to give Virat Kohli his first test victory as India captain.
“A commendable effort by the boys, coming together nicely after that kind of loss (at Galle), regrouping very quickly and putting a performance like this,” Kohli said after the victory.
“We were pumped up to get wickets and we got a perfect start. From there on, the bowlers realised it’s time to squeeze in now and build up some really good pressure,” he added.
Sri Lanka’s day begun in the worst possible fashion when India paceman Umesh Yadav struck with the first ball of the morning which Mathews (23) edged for stand-in wicketkeeper Lokesh Rahul to take a diving, one-handed catch.
Rahul was keeping in place of regular India stumper Wriddhiman Saha, who has been ruled out of the remainder of the series with a hamstring injury.
Mishra struck the next blow, pulling off a classical leg-spinner’s dismissal by bowling Dinesh Chandimal around his legs.
Ashwin and Mishra maintained relentless pressure on the hosts to reduce them to 130-9 when rain brought a premature lunch, but the relief proved short lived as the hosts folded soon after the break.
“We did not play our best cricket,” Mathews rued at the presentation ceremony.
“More disappointing is we could not do it for Sanga, who deserved to leave the field with a high and a win. We promise him we will play our best in the next game and win it for him.”
Rahul, who struck a century in the first innings, was adjudged man of the match.
Ashwin has been equally impressive and with 17 wickets from the first two tests, he is likely to trouble Sri Lanka again in the third and final test in Colombo starting on Friday.
Sangakkara, who made 32 and 18 in his 134th and final test, was given a rousing reception with the Indians shaking hands with him and the former captain being hoisted by his team mates for a round of the stadium as the crowd gave a standing ovation.
(Reporting by Amlan Chakraborty in New Delhi; editing by Patrick Johnston)