With India reeling at 124-6, Dhoni’s decision to bat first appeared to have backfired, but the 34-year-old produced an 86-ball blitz, hitting his fourth sixth off the final ball of the innings to help the hosts to a competitive 247-9.
Dhoni then returned to neatly stump Amla, take three catches and cleverly rotate his bowlers as South Africa were all out for 225 in the 44th over.
Left-arm spinner Axar Patel claimed career-best figures of 3-39, while paceman Bhuvneshwar Kumar also got three wickets as the hosts fiercely defended a modest total, aided by some smart catching.
“A lot of people wait with open sword, they want you to commit a few mistakes and have fun with it,” said Dhoni, who has been under tremendous pressure with questions raging about his role in the squad.
“Overall I would not say a very good or a complete game, definitively we can play better, but it’s good to win games,” said the India captain after collecting the man-of-the-match award.
The Proteas had made public their plans to dismiss India’s in-form batsman Rohit Sharma early and paceman Kagiso Rabada executed it in the second over of the day.
Ajinkya Rahane (51) hit his second successive fifty but India lost the top half of their batting order soon after crossing the 100-mark.
With his team in dire straits and his own reputation at stake, Dhoni let his bat do the talking as he went after the South African bowlers, helping India score 82 runs off the last 10 overs.
The visitors began their chase well but the Indians struck regularly to keep the Proteas in check at Indore’s Holkar Cricket Stadium.
Patel wrecked the tourists’ top order and Virat Kohli made amends for his batting failure by taking three catches, two of them sent back South Africa’s topscorer Faf du Plessis (51) and the dangerous AB de Villiers.
“We had a good start upfront… there is enough experience among myself, (Farhaan) Behardien and (David) Miller to pull it through but unfortunately we got out soft ways tonight,” said De Villiers.
Rajkot hosts the third ODI of the five-match series on Sunday.