India’s captain, Mahendra Singh Dhoni, hammered 92 not out and skilfully marshalled his bowlers to secure a series-levelling 22-run win against South Africa in the second one-day international on Wednesday.

With India reeling at 124 for six in Indore, 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 for nine.

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.

The left-arm spinner Axar Patel claimed career-best figures of three for 39, while the 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 the 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 Africa 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 top scorer, Faf du Plessis, for 51 and the dangerous AB de Villiers for 19.

“We had a good start up front … 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.