The winning run came in comical fashion.
Ashwin should have been caught after skying Angelo Mathews straight up into the air.
But the two Sri Lankan fielders underneath the ball hesitated, and in the end neither even attempted to go for what would have been a simple catch.
The result gave India just their second victory in what has been a trying tour of Australia.
Sri Lanka will attempt to nab their first win under new coach Graham Ford when they take on Australia at the WACA on Friday.
Although India managed to grind out the win, Sachin Tendulkar's bid for a century of centuries continues to drag on after he was dismissed for 48.
Tendulkar, who was almost rested for the Perth match, was in good form before chopping all-rounder Angelo Mathews onto his stumps.
But it mattered little, with India reaching 6-234 in 46.4 overs after restricting Sri Lanka to 8-233 earlier in the day.
Sri Lanka's innings lacked firepower and excitement, with Dinesh Chandimal (64 off 81 balls), Tillakaratne Dilshan (48) and Angelo Mathews (33no off 28 balls) the only batsmen to get going.
Indian paceman Zaheer Khan claimed the key wickets of Kumar Sangakkara (26) and Upul Tharanga (four) to finish with 2-44 off 10 overs, while spinner Ravi Ashwin (3-32 off 10 overs) also played a key role in restricting Sri Lanka to a modest score.
In an innings bereft of highlights, the most entertaining moment came in the 47th over when fieldsman Suresh Raina toppled over the top of a seated security guard while attempting to save a boundary.
The boundary was saved and both Raina and the security guard were fine.
- AAP