(CNN) -- Muttiah Muralitharan made history with his final ball in Test cricket by becoming the first bowler to reach 800 wickets as Sri Lanka thrashed bitter rivals India.
The spinner is the world's leading wicket-taker already but had targeted the landmark total before he hung up his boots after an 18-year career.
When India were reduced to 314-9 it looked as if Muralitharan would be forever stranded on 799 wickets, as Sri Lanka went in search of a resounding victory.
But with what became his last ever ball in Test cricket Muralitharan had India's last batsman, Pragyan Ojha, caught by Mahela Jayawardene.
The 38-year-old was then carried from the pitch in Galle by his teammates, and received a rapturous ovation from the crowd.
India's dismissal for 338 meant Sri Lanka needed only 95 runs to win the first Test and Tharanga Paranavitana and Tillakaratne Dilshan knocked them off for no wickets.
Muralitharan had been due to quit Tests after the November series against the West Indies, but this month brought forward his decision when the India tour was added to the calendar.
He will still be available for the 2011 World Cup which Sri Lanka will co-host with India and Bangladesh, but is expected to retire from all levels of the game after that.
India, the top-ranked team in Test cricket, resumed Thursday on 181-5 as they battled to save the Test. Muralitharan dismissed Harbhajan Singh but looked as if he may be left on 799 wickets as VVS Laxman was run out to leave India nine wickets down.
But Muralitharan produced a final salvo to snare Ojha, Jayawardene pulling off a diving catch -- the 77th time he has taken a catch off Murali's bowling.
The spinner has had a controversial career, with his action the subject of much debate. He was accused of illegally throwing the ball when bowling in 1995, but was cleared by the International Cricket Council after biomechanical tests at the University of Western Australia.
Despite further episodes of controversy Muralitharan kept picking up wickets. He now stands 92 wickets ahead of Shane Warne, who is in second place in the all-time list. The Australian leg spinner retired in 2007.