Sri Lanka reached 45-0 but then lost all 10 wickets for 75 runs to slip to 120 all out, with Kyle Abbott, Aaron Phangiso and Farhaan Behardien each taking two wickets.
Hashim Amla hit 56 in a comfortable chase that an AB de Villiers six completed with 14 deliveries to spare.
However, both teams were eliminated.