47 overs South Africa 283 for 6 (Malan 121, Karunaratne 2-24) beat Sri Lanka 197 (Asalanka 77, Shamsi 5-49) by 67 runs (DLS method)

Janneman Malan scored his third ODI century and anchored a strong South African batting effort to level the series 1-1. South Africa's 283, scored in the absence of Quinton de Kock and Temba Bavuma, required Sri Lanka to pull off the third-highest successful chase under lights on the island in 47 overs, before a much-improved bowling performance from two days ago all but ended Sri Lanka's hopes in the sixth over of their reply.

Kagiso Rabada found his length and some swing to remove Avishka Fernando and Bhanuka Rajapaksa in the space of four balls, and Wiaan Mulder got rid of Minod Bhanuka to leave Sri Lanka 19 for 3. Despite Charith Asalanka's career-best 77, Sri Lanka were never really able to keep up with the required scoring rate. Tabraiz Shamsi finished with a career-best 5 for 49, the best by a South African bowler in Sri Lanka and only the fifth five-for by a South African spinner in an ODI.

Ultimately, Sri Lanka needed someone to bat through the innings in the same way Malan did but didn't have that. After just nine ODIs, he now boasts an average of 104.50 and has made a claim to feature more permanently in the 50-over team. Malan shared two half-century partnerships, 96 for the second wicket with Reeza Hendricks and 86 for the fourth wicket with Heinrich Klaasen, and battled cramp in an industrious innings with few boundaries. On a large and slow outfield, he ran 65 singles, four twos and two threes, with nine fours and one six in the 135 balls he faced.

Sri Lanka helped him along with their effort in the field, which was largely non-threatening even when they were able to keep South Africa quiet, and especially towards the end of the innings. Dushmantha Chameera and Dasun Shanaka conceded at seven runs an over or more, while Akila Dananjaya and Wanindu Hasaranga gave away more than six runs an over. The more economical bowlers, Praveen Jayawickrama, Chamika Karunaratne and Dhananjaya de Silva, all had overs in hand.

Malan and Aiden Markram started solidly and put on an opening stand of 43 in 8.5 overs, before Markram was lured into a drive off Karunaratne and edged to wicketkeeper Minod Bhanuka. That brought Hendricks, installed at No. 3 in place of the injured Bavuma, to the crease. He took on the role of the aggressor and was particularly strong against the short ball while allowing Malan to play more watchfully.

Malan's fifty came off 64 balls with a powerful sweep off Jayawickrama in the 23rd over. Four overs later, Hendricks reached his third ODI half-century with a single off the same bowler. Their partnership was approaching a century when Hendricks played de Silva down the wrong line and was bowled, to force South Africa into another rebuilding phase.

Rassie van der Dussen's innings, filled with characteristic sweeps and reverse sweeps, was short lived but Klaasen played the perfect cameo. He raced to 31 off the first 16 balls before successfully reviewing being given out lbw. Malan received little of the strike in that time and moved from 83 off 107 balls when Klaasen arrived in the 36th over to 99 off 125 in the 43rd. He reached his century off 126 balls, with a single off Chameera.

Malan's cramp worsened as the innings drew to a close, to the point where he could not run as much, and had to chase the boundaries. He was dropped on 107, when he slog-swept Hasaranga to long-on, and went on to clear long-on for his first six and then found four more thanks to a misfield near the rope. Both Klaasen and Malan were dismissed off successive deliveries in the next over but the damage was done. South Africa scored 97 runs in the last 10 overs despite losing three wickets for six runs in eight balls.

Sri Lanka also lost three quick wickets but at the start of their innings. Fernando, Rajapaksa and Bhanuka were dismissed in the space of five balls, leaving de Silva and Asalanka to rebuild. Rabada delivered a six-over opening spell, before Keshav Maharaj brought himself and Shamsi on in tandem. The pair bowled seven overs, gave away 31 runs and Shamsi had de Silva caught down the leg side. By the time allrounder Andile Phehlukwayo was needed, Sri Lanka's required run rate was over seven, which allowed him to find his rhythm.

Rain interrupted Sri Lanka's chase after 25 overs, with them on 114 for 4. A 25-minute break saw the target revised to 265 from 41 overs, which meant that when the match resumed, Sri Lanka needed 171 runs from 22 overs at a rate of 7.77.

The stage was set for Shamsi, who took four wickets after the break. Sri Lanka lost 6 for 72 and were bowled out without reaching 200. South Africa gained 10 points in the World Cup Super League table to leapfrog Sri Lanka into eighth spot, and enter the automatic qualification zone. South Africa's only concern will be the injury Rabada sustained. He was taken off the field with a sprained ankle and will be assessed before Tuesday's series finale.

Firdose Moonda is ESPNcricinfo's South Africa correspondent