Mahela Jayawardene hit his 19th one-day international century to help Sri Lanka beat Afghanistan by four wickets and avoid a major World Cup upset.
Tournament debutants Afghanistan sensed a shock after reducing Sri Lanka to 2 for 2 and then 18 for 3 in Pool A in Dunedin.
But Jayawardene (100) put on 126 with captain Angelo Mathews (44) and although both departed, Sri Lanka held on to win with 10 balls left.
Asghar Stanikzai with 54 was the top scorer in Afghanistan's 232 all out.
The win was Sri Lanka's first of the tournament following their heavy defeat by New Zealand in the opening match, while Afghanistan remain without a point but above England and Scotland - who meet on Monday - on run rate.