England are 0-1 down in the five-Test series and a defeat at Headingley will see Australia retain the Ashes with just two matches to go after this. The second Test at Lord's ended in a draw.
Resuming the day on 156/3 with England skipper Joe Root and all-rounder Stokes at the crease, the hosts seemed to be making light of the daunting 359-run target set by Australia.
At lunch, Bairstow was batting on 34 off 59 balls, his innings laced with four fours, while Stokes continued his graft, batting on 32 off 119 deliveries (4x3, 6x1). The duo added 79 runs in quick time.
The Aussies got Root early after he could add just two runs to his overnight score of 75. The skipper came down the track to Nathan Lyon, trying to work the ball into the leg side. But the ball took an edge onto the back leg and looped to David Warner at first slip who took a brilliant catch. Root's 77 came off 205 balls and included seven hits to the boundary.
In came Bairstow and with the visitors not making the most of the new ball in conditions which were not helping the fast bowlers, the stumper-batsman batted like he does in limited overs cricket to slowly shift the momentum in their favour.
Bairstow milked a glorious straight drive off Hazlewood in the 86th over to get started, and then took a couple off Pattinson to bring up England's 200 amid loud cheers from the packed crowd.
In the fourth ball of that over, Pattinson drifted down the leg side to give away five wides and in what was supposed to be his last ball, he leaked five wides with an atrocious delivery which went through the hands of Warner at slip.
The 87th over cost 13 runs as Bairstow continued to bat aggresively with Stokes holding fort at the other end. The pair also brought up their fifty-run partnership in quick time as the fans sensed an improbable victory which would be the second highest run chase in Test cricket.
Unable to curb the run flow, Paine brought Australia's best bowler Pat Cummins into the attack, but his first ball was flicked for a six by Stokes in the 90th over as the hosts piled on 62 runs in overs between 80-90.
Brief scores at lunch: Australia 179 and 246 (Labuschagne 80; Stokes 3/56); England 67 and 238/4 (Root 77, Denly 50, Bairstow 34, Stokes 32) Target: 359
( With inputs from IANS )