Australia were on the brink of defeat in the first Test after losing four wickets in their record run chase at the Adelaide Oval after being set a target 323 to win by India.
At stumps Australia were 104 for 4, needing another 219 for an unlikely victory with their fate resting on the shoulders of Shaun Marsh and Travis Head.
India scored 307 in their second innings with vice-captain Ajinkya Rahane smashing 70 and first innings century-maker Cheteshwar Pujara a composed 71.
A late collapse got the crowd on their feet and gave Australia a ray of hope, with India's last four wickets falling for just four runs.
Spinner Nathan Lyon was the pick of the bowlers, taking six wickets for 122 runs off 42 overs. It was his 13th five-wicket haul in Tests.
Australia need to make history to win. The only successful fourth innings Test run chase of more than 300 at Adelaide came in 1902, when the hosts made 315 to beat England, with the biggest in modern times the 239 West Indies managed in 1982.
Opener Aaron Finch survived being given out lbw second ball when a review showed Ishant Sharma had overstepped the crease.
He was caught behind off Ravichandran Ashwin’s bowling when the ball whistled past his glove. He chose not to review the decision, which was a mistake. Replays showed the third umpire would have overturned it.
Debutant Marcus Harris matched his first innings score of 26, hitting three crunching boundaries before he was caught by Rishabh Pant off Mohammed Shami, getting an edge on an attempted cut shot.
Australia desperately needed the experienced Usman Khawaja to stick around but he decided to run down the pitch to an Ashwin delivery and ended up slicing it to Rohit Sharma who took a decent catch diving forward.
And when Handscomb miscued a pull shot off Shami on 14 to Pujara, they were in deep trouble.
Play had started 30 minutes early to make up for rain disruptions on Saturday, with Australia desperate for an early breakthrough to build on the momentum after Virat Kohli fell to Lyon near the close on day three.
But two fours from Pujara off Josh Hazlewood in the second over of the day set the tone.
The right-hander his 20th half-century with a three off Lyon and hardly looked troubled until the off-spinner fooled him half an hour before lunch and Finch caught him off bat and pad.
It was a crucial 87-run partnership with Rahane, who survived a bat-pad catch decision off Lyon on review. The vice-captain rubbed salt in the wound by smacking the next ball for four and brought up his 16th half-century with another boundary.
He was eventually out going for a needless reverse sweep off Lyon, with Starc picking up the catch.
The aggressive Pant went in search of quick runs as India's lead approached 300, whacking three fours and a six in succession off one Lyon over.
But when he went for another big hit and fell for a quick-fire 28, it prompted a collapse from 282 for 5 to 307 all out.