Tailender Liam Plunkett hit a six off the last ball of the match as England achieved a remarkable tie in the first one-day international against Sri Lanka in Nottingham on Tuesday.
England, set 287 to win, collapsed to 30 for four and 82 for six.
But a stand of 138 between man-of-the-match Chris Woakes, who made an ODI-best 95 not out, and Jos Buttler (93) revived their chances.
After England had seen their hopes of victory disappear in a final over where they needed 14 to win, Plunkett drove the last ball from Nuwan Pradeep
for a six over long-off to the delight of a capacity crowd at Trent Bridge.
England finished on 286 for eight in just their eighth tie at this level, with Sri Lanka having thrashed them by nine wickets in their previous ODI encounter in Wellington at the 2015 World Cup.
Woakes and Plunkett put on an unbroken 50 in 28 balls.
“It was nice to get that one out,” Plunkett told Sky Sports.
“Woakesy put us in a great position and we bat all the way down.
“It’s good for the team… if you have a wobble up top you can carry on.”
England captain Eoin Morgan added: “Jos Buttler, Chris Woakes and Liam Plunkett have got us out of a hole at the end.
“Jos Buttler called on his experience to guide the innings through and Chris Woakes played out of his skin.”
Sri Lanka captain Angelo Mathews top-scored for his side with 73 and Seekkuge Prasanna blasted a quickfire 59 after England captain Eoin Morgan won the toss.
Warwickshire all-rounder Woakes took two for 56.
Mathews then took two early wickets as England collapsed before they bounced back under the floodlights.
“I thought we had the game in the bag for most of the overs,” said Mathews.
“Unfortunately the yorker fell just off line and went for a six.
“For Pradeep, it happens. Unfortunately for bowlers, it happens.”
England would have been happy with a target of 287 on a ground where last year they made 350 for six against New Zealand-their highest winning score batting second in an ODI.
But it looked an imposing total as they lost four wickets inside nine overs.
Jason Roy (three) was plumb lbw to Mathews.
Fellow opener Alex Hales (four) fell on his Nottinghamshire home ground when he chipped Suranga Lakmal to mid-wicket.
Joe Root (two) then played on to medium-pacer Mathews.
Root’s Yorkshire colleague Jonny Bairstow, recalled to one-day duty after a superb return of 387 runs, including two hundreds, during England’s preceding 2-0 Test series win over Sri Lanka, holed out for three after being dropped on nought.
Morgan made a brisk 43 before he was caught behind off Pradeep, who then removed Moeen Ali to leave England in dire straits at 82 for six.
But Buttler went to a run-a-ball fifty with a straight six off Prasanna.
Buttler eventually fell when a leaping Dasun Shanaka at long-on pulled down what looked like a six off leg-spinner Prasanna.
Woakes and Plunkett got England’s target down to 30 off the last two overs.
And that became 14 off the last six balls.
Woakes took two off the first ball before digging out a yorker for a single that left Plunkett on strike.
Plunkett’s one got Woakes facing again but he couldn’t manage a run and England needed 10 off the last two balls.
England’s ninth-wicket duo scrambled a three to leave them wanting six off the last ball for a tie with Plunkett facing.
But the fast bowler connected sweetly to finish on 22 not out.
Woakes, who might not have played had injured fellow all-rounder Ben Stokes been fit, faced 92 balls.
Earlier, Mathews and Prasanna took Sri Lanka to a competitive total with a fifth-wicket stand of 68.
Prasanna cemented his big-hitting reputation with four sixes in five balls before he was caught and bowled by Woakes.
The five-match series continues with another day/night clash at Edgbaston on Friday.