Batting first, Afghanistan were bowled out for 232 in 49.4 overs.
Sri Lanka made 235 for six off 48.2 overs, with Mahela Jayawardena making 100.
This is his 19th ODI century, and at 37 years and 10 months of age, he is the fourth oldest batsman to score a century in a world cup.