Australia 386 (Khawaja 141, Carey 66, Head 50) and 282 for 8 (Khawaja 65) beat England 393 for 8 declared (Root 118, Bairstow 78, Crawley 61, Lyon 4-149) and 273 (Cummins 4-63, Lyon 4-80) by two wickets
Australia won an epic first Test by two wickets, to take a 1-0 lead over England at Edgbaston, an hour and six minutes after they seemed to have lost it.
But 12 overs later, Cummins and Lyon were still there. Cummins flogged Root for two sixes in the first over of the final hour to make a dent in the target and after surviving a spectacular effort by Ben Stokes at square leg when miscuing a hook, Lyon chipped Stuart Broad over mid-on to take the target down to single figures.
The Eric Hollies Stand roared England's depleted attack on. Cummins dug out a yorker from Robinson and both batters wore short balls on the body. With three to win and 28 balls left, Cummins guided Robinson away to the rope, tossed his bat and helmet away, punched the air and lifted Lyon off his feet. It had echoes of the 2005 Test here - but this time, it was Australia who won by two.
After rain wiped out the first session, he batted through an afternoon in which Australia added 76 runs for the loss of only two wickets - one of them nightwatcher Scott Boland, who edged Broad through to Jonny Bairstow. Travis Head poked Moeen Ali to slip as England kept a lid on the scoring rate, but with 98 to win after tea, Australia were clear favourites.
Khawaja added 49 with Cameron Green in a sixth-wicket stand that spanned the interval, but when Green inside-edged Robinson's in-ducker on to his stumps, Stokes sensed an opportunity.
He brought himself on for his only spell of the second innings, battling his chronic left-knee injury, and smiled wryly when Khawaja chopped his short, slow legcutter on to off stump. The Edgbaston crowd paused for a moment, deceived by Stokes' non-celebration, before erupting into life. England had the most important wicket, and needed only three more.
Root, bowling an extended spell from the Birmingham End with Moeen's blistered spinning finger rendering him unable to grip the ball, dropped two difficult half-chances off his own bowling, giving Carey and Cummins a life each. Stokes opted not to take the new ball when it became available; three deliveries later, Root held a stunning reaction catch.
With Carey gone, Cummins became the protagonist. He has been criticised throughout these five days for a perceived negativity in his tactics, but took control of the game in its decisive passage. Root went full, so he cleared his front leg and swung him down the ground for six - then repeated the trick two balls later.
Broad returned, still with the old ball, and Lyon hooked the second ball of his spell out to Stokes at square leg, 25 yards in from the boundary. He flung himself back, sticking his right hand over his shoulder; the ball looped towards him but escaped his grasp, then squirmed away from his desperate second attempt.
When Cummins slapped a cut for four two balls later, the target was down to 30. Stokes opted to take the new ball, but it offered little for Broad and Robinson. They charged in with spread fields but had almost nothing left in the tank; as if to mark the changing of a guard, James Anderson ambled stiffly around the outfield.
Despite the jibes, Lyon batted more like a No. 3, lacing an off drive for four down the ground to the rope - and beating Robinson at mid-off to his right. After Cummins' off-side slap snuck under Crawley at the cover boundary, Lyon flogged Broad over the top towards the Australian supporters.
They had been barracked relentlessly by the neighbouring Hollies Stand over the course of the Test match but jumped to their feet to celebrate an imminent Australian victory. Three overs later, they did so once more to mark the clinching moment of an enthralling run chase.
England were "devastated", in Stokes' words, but without their enterprising tactics this game would have been written off as a rain-ruined draw. Instead, it bubbled up to a conclusion that had Australians gripped to their television screens until well past 4am - with the promise of four more Tests to come.
Matt Roller is an assistant editor at ESPNcricinfo. @mroller98