MS Dhoni and Bhuvneshwar Kumar's expert salvage job earned India a three-wicket Duckworth-Lewis victory against Sri Lanka after Akila Dananjaya's stunning six-for sparked a collapse from the tourists.
Former captain Dhoni (45 not out) and Bhuvneshwar (53no) gave India a 2-0 lead in the one-day international series with a gritty 100-run partnership to dig them out of the hole Dananjaya sent them tumbling into.
The all-rounder, one of three new faces in the Sri Lanka line-up, bewildered the tourists with his offspin as they chased a revised target of 231 following a rain delay, returning career-best figures of 6-54 as India slumped from 109-0 to 131-7 in less than six overs.
Virat Kohli (4), Kedar Jadhav (1) and KL Rahul (4) were all beaten by Dananjaya in the same over, but the experienced Dhoni and Bhuvneshwar ground out the win with their country's highest eighth-wicket partnership in ODIs.
Wicketkeeper-batsman Dhoni equalled Kumar Sangakkara's record of 99 ODI stumpings by dismissing Danushka Gunathilaka (19) off the bowling of Yuzvendra Chahal, who also removed Kusal Mendis as Sri Lanka lost four wickets for 51 runs midway through their innings.
Milinda Siriwardana (58) and Chamara Kapugedera (40) rebuilt the innings with a stand of 91, but the expert death bowling of Jasprit Bumrah (4-43) accounted for the duo and restricted Sri Lanka to 236-8.
Rain started falling during the break and the consequent delay led to India chasing an adjusted target, Rohit Sharma (54) launching Lasith Malinga (0-49) for four on the second ball to set the tone for an electric start.
Rohit crunched three maximums en route to a 32nd ODI fifty that formed part of a formidable 109-run opening stand with Shikhar Dhawan (49) as India looked set to motor comfortably to victory.
However, Dananjaya had other ideas. The all-rounder, playing in just his sixth ODI, beat Rohit with a googly before a sprinting Angelo Mathews brilliantly launched himself underneath Dhawan's lob off Siriwardana at short fine leg.
Dananjaya made it five wickets in 15 deliveries for Sri Lanka by bamboozling Jadhav, Kohli and KL Rahul in the 18th over, finding a gap between pad and bat to knock down the stumps on each occasion and Hardik Pandya did not learn from their exits.
But the wiley Dhoni provided a masterclass in composure under pressure, picking his shots and keeping the runs trickling through as Bhuvneshwar rotated the strike well before picking up the pace for a first ODI fifty.
Dhoni somehow received a reprieve when the bails refused to budge after the ball deflected off him and bounced onto the base of the stumps, while Bhuvneshwar survived a tight review as Sri Lanka ran out of ideas and fell to a fifth straight defeat on India's tour.