Adelaide - Australia were staring at defeat in the first Test on Sunday 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, who was not out 31, and local boy Travis Head who remained unbeaten on 11.
SCORECARD: Australia v India, 1st Test - Day 4
India amassed 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 flicker 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. Mitchell Starc snared 3 for 40.
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.
The home side can take some comfort, though, by Western Australia in a domestic match last month scoring 313 to beat South Australia here when Marsh was 163 not out.
"We definitely still believe we can win this. It's just about coming out tomorrow, winning the first ball, the first over, the first hour," said Lyon.
"Just simple cricket, we need to not complicate things and just go out there and enjoy ourselves and compete hard and fight our backsides off."
India's assistant coach Sanjay Bangar said he was disappoined his team's tailenders couldn't add more runs, but praised Pujara and Rahane.
"There was a lot of resistence shown by Pujara and he was well supported by Rahane. We managed to scrape through to that total, and then bowlers were brilliant," he said.
"Pujara and Rahane are two of our best Test players and whenever they have done well, they have put us in a good position."
Australian opener Aaron Finch - who survived being given out lbw second ball when a review showed Ishant Sharma had overstepped the crease - made just 11 in his second failure of the match.
He was caught behind off spinner Ravichandran Ashwin 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 on eight and sliced it to Rohit Sharma, who took a difficult catch.
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 needing 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 brought up 50 - his 20th in Tests - 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 brought up his 16th half-century with a 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.