Sangakkara held the innings together and brought up his century with a crisp pull shot off Mitchell McClenaghan.
The stylish left-hander hit 14 boundaries in his 105-ball knock.
Anderson finished with three wickets for 59 runs for New Zealand.
The World Cup, which is co-hosted by New Zealand and Australia, runs from Febraury 14-March 29.
Score Board
Sri Lanka won toss
Sri Lanka
*H D R L Thirimanne lbw b Anderson 30
T M Dilshan c Ronchi b Southee 81
†K C Sangakkara not out 113
D P M D Jayawardene c Ronchi b Southee 14
S Prasanna lbw b Mills 1
L D Chandimal c Ronchi b Anderson 5
N L T C Perera c Mills b Anderson 20
K M D N Kulasekara not out 12
Extras (lb 2, w 9) 11
Total (6 wickets; 50 overs) 287
Did not bat: F D M Karunaratne, R M S Eranga, P V D Chameera
Fall: 1-71, 2-175, 3-203, 4-209, 5-231, 6-253
Bowling: Mills 8-1-42-1 (2w); Southee 10-0-50-2 (1w); McClenaghan 9-0-47-0; Vettori 8-0-52-0 (1w); Anderson 9-0-59-3 (2w); Elliott 4-0-24-0 (2w); Williamson 2-0-11-0
New Zealand
M J Guptill lbw b Kulasekara 0
T W M Latham b Eranga 6
*K S Williamson c Jayawardene b Dilshan 54
L R P L Taylor b Chameera 11
G D Elliott c Chandimal b Chameera 24
C J Anderson c Sangakkara b Eranga 29
†L Ronchi b Kulasekara 47
D L Vettori b Prasanna 35
K D Mills run out 30
T G Southee c Sangakkara b Perera 1
M J McClenaghan not out 5
Extras (lb 5, w 6) 11
Total (all out; 45.2 overs) 253
Fall: 1-0, 2-11, 3-42, 4-101, 5-121, 6-141, 7-215, 8-218, 9-225, 10-253
Bowling: Kulasekara 9-0-55-2 (3w); Eranga 9-1-34-2 (1w); Prasanna 9.2-0-30-1 (1w); Chameera 8-0-60-2; Perera 5-0-42-1 (1w); Dilshan 5-0-27-1
Result: Sri Lanka won by 34 runs
Series: New Zealand won the 7-match series by 4-2
ODI debut: P V D Chameera (Sri Lanka)
Man of the Match: K C Sangakkara (Sri Lanka)
Man of the Series: K S Williamson (New Zealand)
Umpires: C B Gaffaney and R J Tucker (Australia). TV umpire: M A Gough (England). Match referee: J Srinath (India)