De Villiers' unbeaten 73-ball century provided the late impetus as South Africa posted 303 for five, the highest team total at the Green Park Stadium, after deciding to bat first.
Sharma led India's strong reply with a brilliant 150 before leg-spinner Imran Tahir turned the runfeast on its head by claiming two wickets in his final over.
Paceman Kagiso Rabada then dismissed two Indian batsmen in two deliveries in the final over to put South Africa 1-0 up in the five-match series.
"I thought Imran Tahir first of all changed the game and gave us a chance," De Villiers, who was adjudged man-of-the-match for his unbeaten 104-run blitz, told reporters.
"And lot of credit to Dale and Kagiso. The youngster proved quite handful and he has got a bright future," added the South Africa captain who set alight the stadium with his superb stroke-making.
Containing De Villiers is one of the toughest jobs in international cricket and India were severely handicapped when their strike bowler Ravichandran Ashwin left the field after sending down only 4.4 overs.
Ashwin struck in his first over to dismissed Quinton de Kock but Faf du Plessis (62) and Hashim Amla (37) shared a half-century stand.
De Villiers did not hit a boundary in the first 33 balls he faced but was unstoppable when he got going.
When India came out to bat, Sharma added 149 runs with Ajinkya Rahane (60) and the hosts looked on course to chase down the target without any fuss.
Sharma hit six sixes and 13 boundaries before giving a return catch to Tahir who dismissed Suresh Raina in the same over.
India captain Mahendra Singh Dhoni (31) struggled throughout his scratchy knock and fell in the final over.
Off-spinner Harbhajan Singh will join the Indian squad as Ashwin's cover before the second match in Indore on Wednesday.