Chasing 232 to win the series, Australia were cruising at 144-2 before Chris Woakes and Jofra Archer produce a collapse of four wickets for three runs in 21 balls.
A stagger Australia lost their final eight wickets for 63 runs as they were bowled out for 207. In spite of a valiant last wicket partnership of 31 between Alex Carey and Josh Hazlewood.
England earlier collapsed to 149-8, with leg spinner Adam Zampa taking 3-36. Adil Rashid and Tom Curran then pushed them to 231-9.
Eoin Morgan said he wanted his side to learn how to “win ugly” and will be pleased with how they dragged themselves back into the game.