England 237 (Stokes 80, Cummins 6-91) and 254 for 7 (Brook 75, Starc 5-78) beat Australia 263 (Marsh 118, Wood 5-34) and 224 (Head 77) by three wickets
Brook and Woakes added 59 for the seventh wicket, England's highest partnership of the match, before Starc's fifth wicket - Brook top-edging to cover - gave Australia another sniff. But Wood, whose five-wicket haul in the first innings set the game up for England, joined Woakes and iced the run chase.
There is a nine-day break before the start of that Test, one for which both teams will be grateful after another exhausting, exhilarating day which saw both teams let control of the game slip from their grasp. Australia were behind for much of the game but it took until Brook's partnership with Woakes for England to assert their dominance on the chase. Even then, there was a twist - but it came late enough for them to scrape home.
England needed a further 224 runs to win at the start of the fourth day but lost a wicket in the fifth over of the morning: Ben Duckett was smashed on the shin by Starc, falling over to the off side. His review could not save him, with ball-tracking projecting that the ball would have crashed into his leg stump.
Unexpectedly, it was Moeen Ali who walked out at No. 3, after Brook had deputised for the injured Ollie Pope in that role in the first innings. The experiment did not last long - Starc ripped out Moeen's leg stump with a 90mph/144kph rocket - but gave the illusion of extending England's batting line-up and crucially, allowed Brook to return to No. 5.
Joe Root traded boundaries with Zak Crawley either side of drinks but never settled, and a change of ball in the 19th over brought a wicket in the 20th. Crawley crunched Mitchell Marsh through the off side with a trademark cover drive, but Marsh's next ball was a fraction shorter and drew the outside edge.
Brook played positively from the outset, spanking Scott Boland through cover-point for consecutive boundaries, but his stand with Root was a brief one. Cummins dug one in short, angling down the leg side, which Root attempted to pull but gloved through to Alex Carey. It was not Cummins' best ball but extended his remarkable dominance in his head-to-head battle with Root.
Stokes, no stranger to a Headingley run chase, calmly worked his first ball away through the leg side for four but was strangled down the leg side in the second over after lunch, flicking Starc through to Carey to fall for just 13. Starc smiled wryly, exerting his considerable influence on a second successive Test.
Bairstow joined Brook, who had reached 42 after a handful of false shots early in his innings, but did not last long. He inside-edged his sixth ball for four, past his leg stump, then chopped his eighth onto his middle stump, beaten by Starc's movement back into him; after 78 on the opening day of the series, Bairstow has added 63 runs across his next five innings.
Australia sensed an opening. They were four wickets away and Woakes hardly exuded calm early on, regularly playing and missing and picking up boundaries via both edges of the bat. But with Cummins reluctant to introduce Todd Murphy - who bowled only two overs on the last day - Australia were reliant on their three main seamers.
Brook brought up a 67-ball half-century, his second in successive Tests, but both batters continued to keep Australia's fielders interested, particularly when facing the short ball. Top-edges looped up tantalisingly without going to hand, and ball regularly beat bat before the drinks break.
Brook crunched boundaries away through point off Cummins and the lesser-spotted Murphy, but was rushed by Starc's short ball and spooned a catch to cover via the top edge, trudging off with 21 runs still required. But It took England only 14 balls to knock them off.
Murphy's brilliant parry on the midwicket boundary denied Woakes a certain boundary, but Wood - fuelled by adrenaline - took on Cummins' bouncer and swiped him into the Football Stand for six. When Wood crunched Starc through cover, England were close; when Woakes slashed him through point, they had their first Ashes win in four years.
Matt Roller is an assistant editor at ESPNcricinfo. @mroller98