Published: 2019-03-06 04:29:32 BdST
Chasing India's 251 to level the five-match series, Australia got off to a strong start before the hosts roared back into the contest with some disciplined bowling.
It all came down to the final over, with the tourists needing 11 runs to win with two wickets in hand.
But Shankar struck twice in the first three balls of the over and Australia were all out for 242.
Marcus Stoinis was the top scorer for Australia with 52 but his dismissal in the first ball of the final over snuffed out Australia's hopes of a win in the see-saw contest.
India now take a 2-0 lead into Friday's third ODI in Ranchi.
Earlier, Kohli's 40th ODI century helped India, who had won the first match by six wickets, post 250 before being all out with 10 balls to spare at Nagpur's Vidarbha Cricket Association Stadium.
Aaron Finch and Usman Khawaja led Australia's robust reply with an opening stand of 83 before the Indian spinners hauled the hosts back into the contest with a flurry of wickets.
Kuldeep Yadav (3-54) dismissed Finch for 37 and, in the next over, Kedar Jadhav sent back Khawaja for 38.
In-form Glenn Maxwell perished cheaply, and Australia found themselves in a hole when Ravindra Jadeja ran out Peter Handscomb (48) with a direct throw.
Stoinis tried his best down the order but it was not enough in the end.
Having elected to field, Australia had begun strongly with Pat Cummins, armed with the new ball, sending down a maiden-wicket over in which he dismissed Rohit Sharma for a duck.
Australia employed spin from both ends after six overs, and soon Maxwell trapped Shikhar Dhawan lbw while Nathan Lyon dismissed Ambati Rayudu.
Kohli and Shankar combined in a breezy 81-run stand to arrest the slide and take India past the 150-mark.
Kohli needed 55 balls to bring up his half-century but Shankar missed his fifty as Adam Zampa triggered a mini-collapse.
Shankar dived back but was run out for 46 after Kohli's straight drive brushed Zampa's fingers before hitting the stumps.
Zampa dismissed Kedar Jadhav and Mahendra Singh Dhoni in successive deliveries, but Kohli batted with elegance to bring up his century in 107 balls.
The right-hander stroked 10 boundaries in his risk-free knock, sprinting tirelessly between the wickets to pick up runs, before eventually falling to Cummins (4-29).