Kumar Sangakkara was the hero as Sri Lanka defeated New Zealand to restore some pride in their final one-day international of the series.