When Australia lost their ninth wicket on the fifth and final day, they were 80 runs adrift of their victory target of 311 and all but out of the match.
But by lunch they were 291 for nine, just 20 runs away from a stunning upset with Brad Haddin 69 not out and James Pattinson unbeaten on 22.
However, the third over after lunch saw Haddin, on 71, eventually given out caught behind by opposing wicketkeeper Matt Prior off man-of-the-match Anderson's full-length delivery
England, in a Test full of controversial umpiring decisions, had though first to challenge Pakistani on-field umpire Aleem Dar's original not out verdict.
But third umpire Marais Erasmus, using Hot Spot technology, overturned the call and that meant Ashes-holders England had gone 1-0 up in this five-match series ahead of the second Test at Lord's on Thursday.
Pattinson finished on 25 not out after a last-wicket stand of 65.
It was the second remarkable last-wicket Australia stand of the match after their first innings 163, a tenth wicket Test record featuring teenage debutant Ashton Agar's 98 -- the highest score by a Test No 11.
England spearhead seamer Anderson, who took four wickets for 12 runs Sunday, finished with an innings return of five for 73 and a match haul of 10 for 158.
All was going well for England earlier Sunday when a sensational new ball saw Anderson take three wickets for six runs as Agar (14), Mitchell Starc (one) and Peter Siddle (11) were all caught by England captain Alastair Cook at first slip to leave Australia nine down.
But when Pattinson swept off-spinner Graeme Swann for six, Australia needed just 31 more runs for victory.
Jonny Bairstow then had a chance to run out Haddin but his throw from cover-point missed the stumps.
Haddin, with 26 needed to win, was dropped on 64 by a diving Steven Finn, running round in the deep, off Swann.
Australia resumed Sunday on 174 for six still needing a further 137 runs to win after they lost three wickets for three runs late in Saturday's play.
But the fact 19-year-old Agar, promoted to No 8, was still there was a warning to England not to under-estimate Australia's tail.
Haddin, 11 not out overnight, continued to mix aggression with defence, and took Australia to 200 when he cover-drove fast-medium bowler Anderson for four.
Anderson, one of only four England bowlers to take more than 200 Test wickets, eventually had had left-hander Agar edging to Cook.
And Australia's 207 for seven soon became 211 for eight when Starc, who has a Test-best score of 99, managed just a single before he too fell to the Anderson-Cook combination.
The pair almost had their third wicket when Siddle on 10 got an edge only for Cook to drop the chance.
However, Siddle added just one more run to his total before he edged a full-blooded drive off Anderson and Cook, going high to his right, held a sensational catch.
England had put themselves into a strong position thanks to a seventh-wicket second innings stand of 138 between Ian Bell (109) and Stuart Broad (65).
But Broad was controversially given not out on 37 despite edging the ball to slip - one of several contentious decisions in this enthralling match.
Australia 280 (A.Agar 98, P.Hughes 81 not out, S.Smith 53, J.Anderson 5-85) &
296 (B.Haddin 71, C.Rogers 52, S.Watson 46, J.Anderson 4-73)
England 215 (J.Trott 48, P.Siddle 5-50) &
375 (I.Bell 109, S.Broad 65, K.Pietersen 64, A.Cook 50)