Mahela Jayawardene's century rescued Sri Lanka from a batting meltdown as they beat Afghanistan by four wickets in their World Cup match in Dunedin on Sunday.
Set a modest target of 233 to win the Pool A game, 1996 champions Sri Lanka were stunned when openers Lahiru Thirimanne and Tillakaratne Dilshan both fell for golden ducks.
They were in further strife at 51 for four before Jayawardene (100) and skipper Angelo Mathews (44) rectified the innings with a 126-run partnership before Sri Lanka won with 10 balls to spare at University Oval.
Jaywardene's crucial innings was his 19th ODI century and one of his most valuable as Sri Lanka, losing finalists at the last two World Cups, were in trouble before he set about taming the bowling.
This was Sri Lanka's first win in two games this tournament following a 98-run defeat by New Zealand, but the plaudits went to World Cup debutants Afghanistan, who only let themselves down with a slow run-rate in the second half of their innings.
Sent in to bat in spicy, overcast conditions they reached 169 for four before the the last 15 overs saw six wickets go down as they were dismissed for 232 with two balls remaining.
It left Sri Lanka with a modest chase but an experienced side made life difficult for themselves as, for only the second time in one-day international history, both openers fell first ball.
Dawlat Zadran had Thirimanne leg before wicket with the first ball of the innings and Dilshan was caught behind off the first ball he faced from Shapoor Zadran in the second over.
The slump did not end there as Hamid Hassan continued the demolition of the Sri Lankan top order.
He bowled Kumar Sangakkara for seven and Dimuth Karunaratne was caught behind for 23 as Sri Lanka reeled at 51 for four against an Afghanistan side beaten in their tournament opener by Bangladesh.
After leaving the field to address problems with his boots, the flamboyant Hassan came back to end Jayawardene's stand and finished with figures of three for 45.
Sri Lanka were 178 for six, requiring 54 runs in under nine overs, when Thisara Perera eased their nerves with a decisive and quickfire unbeaten 47.
Afghanistan may be regarded as rank outsiders but Dawlat Zadran, Shapoor Zadran and Hassan taught Sri Lanka a lesson on how to utilise the conditions.
With cloudy skies following overnight rain, and with the ground renowned for early swing, Mathews did not think twice about fielding when he won the toss.
However, Lasith Malinga and Suranga Lakmal were too loose to threaten Afghanistan openers Javed Ahmadi and Nawroz Mangal, who eventually engineered their own dismissals playing rashly at innocuous deliveries.
Their removal united Asghar Stanikzai (54) and Samiullah Shenwari (38) in the middle to produce a well-crafted 88-run partnership for the fourth wicket, Afghanistan's best stand against a top-eight side.
Mirwais Ashraf chimed in with 28 as for the first time in their six-year, 47-game ODI history, Afghanistan's top eight batsmen all reached double figures.
Mathews and Malinga both took three for 41.