Chasing 181, visiting Sri Lanka were bowled out for 87 runs with Yuzvendra Chahal picking up four wickets.
Stand-in-skipper and opener Rohit Sharma could not accumulate runs for the side and departed for just 17. It was KL Rahul, who then gave India a good start and contributed significant 61, the highest score from the Indian side.
After departure of Rahul, it appeared that India would not be able to cross the 150-mark, but Dhoni and Pandey's fireworks brought 61 runs in the last four overs to give the hosts a good total.
Dhoni scored unbeaten 39, while Pandey contributed 32 at the crucial time.
Chahal was declared the Man of the Match. (ANI)