While the result did not stop South Africa taking the series 3-2, Dananjaya's performance established the pint-sized 24-year-old as one of the most threatening spinners on the international circuit.
Sri Lanka captain Angelo Mathews hit 97 off 97 balls as his side made 299 for eight off their 50 overs. Dananjaya then ripped through the South Africa batting lineup as they aimed for the biggest target score taken on by a visiting country at Colombo's R. Premadasa stadium.
The tourists were all out for 121 two balls short of 25 overs. Dananjaya, who took six for 29, became one of just four spin bowlers with two six-wicket hauls in one-day internationals.
"Akila knows what he's doing with the ball. It's hard to take on someone like this when he has so many variations up his sleeve," said de Kock, who got precious little support.
"We have batted well against him in this series, but today he bowled really well." Dananjaya's spin accounted for four of South Africa's top five batsmen -- de Kock, Aiden Markram, Reeza Hendricks and Heinrich Klaasen. Apart from the captain, they managed just 23 runs between them.
Niroshan Dickwella set the tone for a determined batting display by Sri Lanka, hitting 43 off 65 balls before Mathews proved he is becoming a force again after a series of injury layoffs.
Mathews also started slowly, but his final 47 runs came off just 31 balls.
"This was a performance we were looking for but it came in the last match.
"If we had been like that in the first three games things could have been a lot different," said Mathews.
Despite the fightback in the last two matches of the series, Mathews insisted that the team are still "a work in progress" as they head for the World Cup in England next year.
"We have got about 20 more games so we are looking to get better. We want to make the most of it." After South Africa lost both Test matches in Sri Lanka, de Kock said it was a relief to win the one-day series. "It is never easy coming here and winning in Sri Lanka." South Africa's tour ends with a T20 game against the Sri Lankans at the same Colombo stadium on Tuesday.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)