Opting to bat, Sri Lanka rode on their skipper Angelo Mathews' unbeaten 116-ball 139 to put up a challenging 286 for eight at the JSCA International Stadium Complex, before Kohli (139) guided India home with eight balls to spare. It was their best ever fight on the gruelling tour that came up suddenly, and heavy dew played a big role in their narrow defeat. Earlier, struggling at 85/4 in 18.3 overs, Mathews arrested the slide and ensured that they produce some fight for the first time in their most forgettable two-week sojourn.
Kohli struck 12 fours and three sixes during his 126-ball captain's knock as India boosted their confidence ahead of the tough upcoming tour of Australia.
A screaming Kohli sealed the issue by hitting Mendis for a six over long-on after completing his 21st century and the fourth this year.
Incidentally, Mathews too scored the same number of runs runs in setting up respectable score, but the day belonged to his Indian counterpart as India geared up to the Australia tour before the World Cup with a memorable series triumph.
Watched on by his GCA president Amit Shah, Axar Patel played a perfect cameo remaining unbeaten on 17 from 14 balls in an undefeated 57-run partnership from 32 balls.
Chasing a fighting 287, India looked in firm control with Kohli and Rayudu (59 from 69 balls) putting on 136 runs for the third wicket, but the latter was unfortunately run out by the skipper triggering a mini collapse.
Lanka almost had the twist in the tale after Mendis (4/73) claimed the wickets of Stuart Binny and R Ashwin in successive deliveries as Kohli remained stranded at the other end.
The collapse that began with Rayudu's wicket meant India lost five wickets for 81 runs but Kohli held his nerves and took on Mendis, stepping out to hit a big six and a four to turn the match in India's favour.
Scripting yet another run chase, Kohli brought back the memories of his 77 not out in their run chase against England in January last year, in the first match at the venue.
Mathews' 116-ball knock was laced with six fours and 10 sixes.
With their senior batsmen coming a cropper yet again, Mathews found a perfect ally in his deputy Lahiru Thirimanne, who made 52 off 76 balls with the help of two fours and a six, in their 128-run partnership.
Mathews also excelled with the ball, dealing two early blows on India as he removed both the openers in his first two overs to give the hosts their worst start of the series.
Rahane was out for two after a good length ball kept low and the batsman could not do much, but the biggest joy for the Lankans came when Mathews castled the record-breaking man Rohit Sharma, who got out for 9 after playing a cross-batted shot.
At 14/2 in 4.3 overs, the Lankans had the best chance to sign off on a winning note.
But a resolute and ruthless Kohli stood in their way as the stand-in skipper formed a perfect alliance with Rayudu to set up the chase.
The duo ran hard for singles and scored mostly in the V without taking much risks on a wicket that had some uneven bounce and aided spin.
The duo completed 100 runs from 108 balls in a risk-free approach against an innocuous Lankan attack.
Nothing going for them, the Lankans needed a miracle to break the partnership and the duo had a blip in the middle when Kohli ran Rayudu out after the latter completed his half-century.
Having ran the length of the pitch, Rayudu was sent back by an unmoved Kohli only to sacrifice his wicket in an uncalled manner.
Rayudu, Uthappa and Jadhav fell for addition of 65 runs with the target still 72 runs away as Kohli looked restrained and approached his 100 in singles and twos.
Earlier, Mathews broke loose when he hit Karn Sharma for a six over extra cover to complete his half-century in 76 balls.
The Indian bowlers suddenly looked lacklustre with Mathews hitting lusty blows and in one over the Lankan captain hit part-time bowler Rayudu for two sixes and a four as their partnership crossed 100-mark in just 134 balls.
Firing in all cylinders, Mathews' second 50 came in just 26 balls and then raced to his first ODI century, surpassing his previous best of 93 (against Pakistan in August).
Opting to bat, Sri Lanka rode on their skipper Angelo Mathews' unbeaten 116-ball 139 to put up a challenging 286 for eight at the JSCA International Stadium Complex, before Kohli (139) guided India home with eight balls to spare.
It was their best ever fight on the gruelling tour that came up suddenly, and heavy dew played a big role in their narrow defeat.
Earlier, struggling at 85/4 in 18.3 overs, Mathews arrested the slide and ensured that they produce some fight for the first time in their most forgettable two-week sojourn.