The hosts had to sweat a bit to wrap up the remaining five wickets and dismiss the world's number one team for 338 in their second innings, a total largely built around gritty contributions from tailenders.
With rain clouds hovering over the stadium, the Sri Lankan openers Tillakaratne Dilshan (68 not out) and Tharanga Paranavitana (23 not out) showed great urgency to rattle up the required runs on the final day to take a 1-0 lead in the three-match series.
Dilshan brought about the victory in style by clobbering Harbhajan Singh for a mighty six as the Lankans raced to 96 no loss in just 14.1 overs to record their seventh 10-wicket win overall and the second against India.
Resuming at a precarious 181 for five, India lost captain Mahendra Singh Dhoni (4) and Harbhajan Singh (8) in quick succesion but VVS Laxman (69) and a dogged resistance by tailenders Ahimanyu Mithun (25), Ishant Sharma (31 not out) and Pragyan Ojha (13) delayed the inevitable.
The late order fightback not only frustrated the hosts but helped India to avoid the ignominy of an innings defeat and take a slender lead to stretch the game beyond the tea break at the Galle International stadium.
Muralitharan hiumself played a key role in his swansong Test by scalping five wickets in the first innings and three in the second to take his overall tally to 800, thus becoming the first cricketer to achieve the remarkable feat.
India's capitulation was all the more shocking considering an entire day's play was washed out because of rain. While nothing great was expected from the depleted bowling attack, the failure of the star-studded batting line up hurt the team badly.
The two teams will now travel to Colombo for the second Test starting July 26 and another defeat could dislodge India from the number one position.
If Sri Lanka win the series 2-0, India would lose four rating points and come down to the third position behind South Africa. Sri Lanka, on the other hand, will gain six points and become the number one team.
All eyes were on Muralitharan as the crowd and his teammates expected him to reach the 800-wicket mark quickly but the off-spinner could add just one more scalp to take his tally to 799 till the lunch break.
It was paceman Lasith Malinga who took two of the three wickets that fell in the opening session by removing India skipper Mahendra Singh Dhoni and Mithun.
Dhoni and Laxman resumed at overnight score of 181 for five and India's fate hinged much on their efforts with the bat. Malinga though shattered India's hopes by bowling out Dhoni with a beautiful yorker.
Muralitharan then trapped Harbhajan Singh (8) to trigger celebrations but the spirited resistance by the tailenders from then on raised hopes of an Indian escape.
Laxman, who was on nine overnight, on the other end was unruffled and frustrated the hosts with his fighting half-century.
His 49-run partnership with Mithun (25) for the eighth wicket and unfinished 68-run stand for the ninth wicket was crucial in saving India from the innings defeat.
After supporting Laxman for an hour, Mithun became the fifth victim of Malinga. Confronted with a screamer of a delivery, Mithun was no where in line and was adjudged plumb leg before.
After Mithun, Ishant showed the stomach for a fight and battled hard for India's cause.
Ishant (31 not out) became only the fourth batsman to face 100 or more balls in a Test innings while batting at number 10 position.
VVS Laxman (69) and Ishant resumed the post lunch session and raised a 68 run stand for the ninth wicket, the best at Galle International stadium. It bettered the previous 60-run stand between Rahul Dravid and Venkatesh Prasad.
Laxman's run out brought relief for the hosts but it left Muralitharan in a situation where only one wicket was on offer and he had to get that to complete his 800-wicket tally.
Laxman's fighting fifty had five fours and and ended in an unfortunate manner as he and Ishant went for a risky run.
Ojha joined the action after Laxman's dismissal and with Ishant he frustrated the hosts for another 15 overs.
Ishant survived two furious appeals off Muralitharan and a stump chance off Dilshan in his brave unbeaten innings.
The not out decision by third umpire on that stump chance was cheered by the crowd as it could have left Muralitharan stranded on 799 in his farewell Test.