England have won the first Ashes Test against Australia by 14 runs as James Anderson claimed 5-73 in a thrilling final day at Trent Bridge.
Chasing 311, Australia battled on at 231-9 before its last-wicket pair of Brad Haddin (71) and James Pattinson (25 not out) took the total to 296 and the brink of a famous victory.
Haddin was given out caught behind after a referral revealed he had got the faintest inside edge to Anderson in the third over after lunch.
England leads the five-Test series 1-0. The second test starts at Lord's on Thursday.
However, Australia captain Michael Clarke said that his team proved a point despite the agonising loss.
"I hope we get a bit of respect by the way we've played,'' Clarke said.
"People who've written us off, I think we might have showed enough to change their minds. I think our boys should hold their heads high.''
Anderson had earlier taken three wickets during the morning session.
Close to record
However, Haddin and Pattinson put on 65 for the final wicket and were close to breaking the record for a last-wicket pair to win a test match, set by Inzamam-ul-Haq and Mushtaq Ahmed, who made 57 for Pakistan versus Australia in 1994.
Play began with the floodlights on to combat the overcast conditions and the first runs of the morning came when Haddin flashed Anderson through third slip for four in the second over of the session.
England opted not to take the new ball until the 82nd over and Australia took this as a cue to attack.
Haddin cut Anderson through extra cover for four to take the tourists past 200, prompting England captain Cook to set more defensive fields.
Agar (14) offered few chances, but he finally fell after 57 minutes when he nudged Anderson to first slip.
Mitchell Starc then fell in almost identical fashion, lasting just five balls before he was tempted by Anderson and caught by Cook for 1.
Lunch session extended
Peter Siddle reduced the target to less than 100 with successive boundaries off Broad and was dropped by Cook off Anderson when he was on 10.
Cook atoned brilliantly in Anderson's next over with a superb diving catch.
Anderson bowled for nearly two hours from the Radcliffe Road End but, when he was replaced, Haddin smashed Steven Finn for three consecutive boundaries.
The lunch session was extended as England chased the final wicket, but Finn bowled two overs for 24 runs and Pattinson hit Swann for six over midwicket to reduce the target to 31.
Haddin was nearly run out on 62 but Jonny Bairstow's throw was easily wide and Finn's wretched morning continued when Haddin lofted Swann to the square leg boundary and he dropped a difficult chance, spilling the ball for four
The lunch interval gave Anderson the chance to recover and in his second over of the session Haddin swished at the fifth ball.
Haddin was initially given not out by Aleem Dar but England referred the call. The hotspot camera revealed an almost imperceptible edge and the tourists' run chase was thwarted in the most agonising fashion.