The three-wicket victory left the hosts 2-1 up in the series with one game left. Australia will retain the Ashes they have held since 1989 if they can win at The Oval.
Leg-spinner Warne took three wickets for seven runs in 29 balls as the home side, chasing 129 to win on a blameless pitch, stumbled to a nervy 57 for four.
Strike bowler Lee then tore out the middle order to make it 111 for six and keep the 16,000 capacity crowd on tenterhooks.
Warne added a fourth wicket and his eighth of the match with 13 still needed for an England victory but Ashley Giles and Matthew Hoggard clung on to spark scenes of jubilation around the ground.
Warne, who took four wickets in the first innings and made 45 off 42 balls earlier in the day, ended with four for 31 off 13.5 overs. Lee took three for 51.
Australia have won the last eight Ashes series dating back to 1989. The fifth Test starts on Sept 8.
Earlier Australia, having been forced to follow on for the first time in 17 years on Saturday, battled hard through the opening two sessions to wipe out their 259-run deficit before being dismissed for 387.
The nail-biting finale followed two equally enthralling Test at Edgbaston, where England won by two runs to level the series, and Old Trafford where the Australians clung on for a draw with one second-innings wicket standing.
Australia’s one chance of completing an extraordinary escape seemed to depend on rattling English nerves with Warne the most likely architect and he came on as early as the sixth over.
By then the target had been reduced to under 100 after Marcus Trescothick had smacked Michael Kasprowicz out of the attack with a series of drives, cuts and carves.
Warne, though, struck with the first ball of his first two overs to get rid of the left-handed Trescothick and the right-handed Michael Vaughan.
Trescothick pushed forward and pad-batted the ball to Ricky Ponting at silly point after his 22-ball 27.
Moments later it was 36 for two as Warne spun a delivery sharply out of the rough. Vaughan, yet to score and looking to flick to leg, edged into Matthew Hayden’s waiting hands at slip.
Andrew Strauss, joined by Ian Bell, countered with a slash for four off Brett Lee and a cut to the boundary off Warne.
Back came Warne and Lee as two wickets fell in three balls and the pressure mounted again.
Strauss, on 23, glanced Warne straight to leg slip. Bell then needlessly hooked at Lee and top-edged the ball straight to Michael Kasprowicz at fine leg.
Pietersen and Flintoff, though, put on 46, the major stand of the innings before Pietersen edged the returning Lee behind to make it 103 for five. Eight runs later the strike bowler produced a stunning delivery which cut back inside Flintoff’s bat to clip the top of the off stump.
When Geraint Jones slogged at Warne and was caught at deep extra cover it was 116 for seven and the unlikeliest of upsets seemed on the cards.
Lee at last got it wrong, however, and Hoggard flailed a full toss through extra cover to put England within one shot of victory.
When Warne got his hands back on the ball, England needed one to tie and two to win with the shadows lengthening. Giles finally ended the drama with a flick towards the mid-wicket boundary.
The final pair put on 13 runs. Steve Harmison was due in next, with Simon Jones — in a surgical boot at the start of play after injuring his right ankle — the last man.
Earlier, Michael Clarke and Simon Katich had given Australia hope in the morning session, putting on 100 after the world champions, following on and 259 runs behind, had resumed on 222 for four.
Clarke fell 10 minutes before lunch after he had made 56.
It was 270 for five at the break and from then on England, without injured fast bowler Simon Jones, kept chipping away.
Adam Gilchrist and Katich were the last hopes for Australia to stay level in the five-match series but neither managed to produce a major innings.
Gilchrist made 11 before Hoggard straightened a delivery which began on middle and would have hit leg. It was the first time in 72 Tests and 105 innings that Gilchrist had gone lbw to a bowler other than a spinner.
Katich followed for 59, his eighth test half-century. A study in concentration, the left-hander fell lbw to Harmison, although television replays suggested the ball had pitched outside leg stump and would have cleared the wicket.
Warne responded by hitting out. He hoisted Giles’s left-arm over long on for six, then just cleared the bowler’s fingertips with a return drive.
Jones, who has had a wretched time behind the stumps during the series but whose 85 in the first innings was a crucial contribution, again bungled when missing a run-out.
Australia’s tail continued to wag furiously and fortuitously as their last men flailed the bat.
Warne continued hitting, with another six off Giles, but the spinner and the wicket-keeper got things right at last as Warne slogged again on the charge and was stumped. His 45 came off 42 balls, with two sixes and five fours.
Pietersen dropped Kasprowicz on 18 above his head at mid-wicket off Flintoff just before tea. It was Pietersen’s sixth dropped catch of the series.
Scoreboard
ENGLAND (1st Innings) 477 (A. Flintoff 102, G.O. Jones 85, M.E. Trescothick 65, M.P. Vaughan 58; S.K. Warne 4-102).
AUSTRALIA (1st Innings) 218 (S.P. Jones 5-44).
AUSTRALIA (2nd Innings, overnight 222-4):
J.L. Langer c Bell b Giles 61
M.L. Hayden c Giles b Flintoff 26
R.T. Ponting run out 48
D.R. Martyn c G. Jones b Flintoff 13
M.J. Clarke c G. Jones b Hoggard 56
S.M. Katich lbw b Harmison 59
A.C. Gilchrist lbw b Hoggard 11
S.K. Warne st G. Jones b Giles 45
B. Lee not out 26
M.S. Kasprowicz c G. Jones b Harmison 19
S.W. Tait b Harmison 4
EXTRAS (B-1, LB-4, NB-14) 19
TOTAL (all out, 124 overs) 387
FALL OF WKTS: 1-50, 2-129, 3-155, 4-161, 5-261, 6-277, 7-314, 8-342, 9-373.
BOWLING: Hoggard 27-7-72-2 (1nb); S.P. Jones 4-0-15-0; Harmison 30-5-93-3 (1nb); Flintoff 29-4-83-2 (9nb); Giles 28-3-107-2; Bell 6-2-12-0 (3nb).
ENGLAND (2nd Innings):
M.E. Trescothick c Ponting b Warne 27
A.J. Strauss c Clarke b Warne 23
M.P. Vaughan c Hayden b Warne 0
I.R. Bell c Kasprowicz b Lee 3
K.P. Pietersen c Gilchrist b Lee 23
A. Flintoff b Lee 26
G.O. Jones c Kasprowicz b Warne 3
A.F. Giles not out 7
M.J. Hoggard not out 8
EXTRAS (LB-4, W-5) 9
TOTAL (for seven wkts, 31.5 overs) 129
FALL OF WKTS: 1-32, 2-36, 3-57, 4-57, 5-103, 6-111, 7-116.
BOWLING: Lee 12-0-51-3 (5nb); Kasprowicz 2-0-19-0; Warne 13.5-2-31-4; Tait 4-0-24-0.
RESULT: England won by three wickets.
UMPIRES: Aleem Dar (Pakistan) and S.A. Bucknor (West Indies).
TV UMPIRE: M.R. Benson (England).
MATCH REFEREE: R.S. Madugalle (Sri Lanka).
MAN-OF-THE-MATCH: Andrew Flintoff.
FIRST TEST: Lord’s, Australia won by 239 runs.
SECOND TEST: Edgbaston, England won by two runs.
THIRD TEST: Old Trafford, match drawn.
FIFTH TEST: The Oval, Sept 8-12.—Agencies