Cheteshwar Pujara and Ajinkya Rahane shared an unbroken fifth-wicket stand of 93 to keep alive India's hopes of a series-levelling win over Australia, giving the hosts a lead of 126 on a see-saw third day of the second test in Bengaluru.
India's chances appeared slim when paceman Josh Hazlewood's triple strike helped Australia reduce them to 120 for four before tea and the touring side looked favourites to take a 2-0 lead in the four-match series.
But Pujara and Rahane batted through the final session to ensure India will set them a decent target to chase on a difficult pitch.
At close of play, Pujara was unbeaten on 79 with Rahane on 40 to take India, who lost the opening test of the four-match series by 333 runs, to 213 for four.
Earlier, left-arm spinner Ravindra Jadeja took six for 63 as India fought back to dismiss the tourists for 276 in the morning session before Hazlewood's haul swung the test back in Australia's favour.
The paceman struck in the first over after lunch to send back opener Abhinav Mukund and returned late in the session to dismiss India captain Virat Kohli in a huge setback for the home side.
India promoted Jadeja up the order to make a left-right batting combination but he scored just two before the 26-year-old Hazlewood clean bowled him.
Mukund's first test in almost six years ended on a sorry note as his off-stump was uprooted for 16 following a first- innings duck.
Fellow opener Lokesh Rahul completed his second fifty of the match before he fell for 51 to left-arm spinner Steve O'Keefe, Australia captain Steve Smith completing a flying, one-handed grab at slip.
Pujara, who was dropped on four by Smith off Nathan Lyon, and Kohli initially batted without much trouble before the latter was given out lbw for 15.
Kohli reviewed the decision immediately and despite several replays, it could not be determined if he had hit the ball before it struck his pad and the umpire's decision was upheld.
The day started with Australia resuming on 237-6, a lead of 48, and the tourists added 32 runs before losing their last four wickets for seven runs.
India were looking to race through Australia's lower order but left-handers Matthew Wade and Mitchell Starc kept them at bay for the first 45 minutes.
The Australians dealt well with the threat of off-spinner Ravichandran Ashwin before Starc perished for 26, holing out to a brilliant catch from Jadeja on the deep mid-wicket boundary to trigger a collapse.
Kohli finally brought on Jadeja in the ninth over of the day and the left-armer Jadeja trapped Wade leg before for 40 and repeated the feat with his next ball to Lyon to complete his seventh five-wicket haul in tests.
Hazlewood denied Jadeja (6-63) his hat-trick but soon became the 28-year-old's sixth victim.