Sri Lanka 300 for 9 (Fernando 118, Asalanka 72, Maharaj 2-30) beat South Africa 286 for 6 (Markram 96, van der Dussen 59, Dananjaya 2-65) by 14 runs

Sri Lanka scored 90 runs off the last 10 overs of their innings and defended 90 in the last 10 overs of South Africa's to take the series lead and 10 points into the World Cup Super League table. History was on the hosts' side, with no team ever successfully chasing a total over 300 in a day-night game on the island. South Africa, on 210 for 3 after 40 overs, were well-placed but Sri Lanka's attack held its nerve.

Wanindu Hasaranga and Akila Dananjaya combined well for seven overs with Dananjaya removing the well-set Rassie van der Dussen for a run-a-ball 59. Then, Dushmantha Chameera and Chamika Karunaratne were left 37 to defend off the last three overs and, with a combination of slower balls and full-length deliveries, the pair kept South Africa to 286.

South Africa's chase suffered its first major dent when their captain Temba Bavuma had to retire hurt after 28 overs. Bavuma was struck on the right thumb two overs before, after pushing the ball to midwicket, and then attempting to avoid the fielder's throw. He took his glove off immediately, which revealed some blood and swelling, and received on-field attention for several minutes and continued, but not for long.

At that stage, Bavuma and Aiden Markram had shared in a 106-run second-wicket stand, Markram was on 91 and South Africa were scoring at 5.53 runs an over, below the required run-rate of 6.63 but in control. Seventeen deliveries later, Markram was out too, caught by a diving Hasaranga at deep cover as he tried to clear the rope in search of a first ODI century. Markram fell four short and could not trump Avishka Fernando, whose 118 off 115 balls led Sri Lanka to 300.

As disappointed as South Africa will be with their batting, they lost most of the game in the field and will want to consider both the composition of their attack and their approach to these conditions. South Africa opted for only five frontline bowlers and relied on Markram's part-time offspin for six overs. Their quicks, Kagiso Rabada and Anrich Nortje, were too short, the allrounder, Andile Phehlukwayo lacked control, and Shamsi was inconsistent. Keshav Maharaj, though, was outstanding. He produced his most economical return in ODI cricket and became the only South African spinner bar Imran Tahir to concede 30 runs or fewer in a ten-over spell in almost a decade.

What Maharaj lacked was what Sri Lanka had - someone to help keep things tight. Sri Lanka's spin trio - Hasaranga, Dananjaya and Praveen Jayawickrama - bowled 28 overs between and conceded 134 runs at a rate of under five an over but did not cause the damage that might have been expected. By and large, South Africa handled them well, particularly Markram, who is a much-improved player from the one who made 0 and 3 on a tour to Sri Lanka three years ago.

When Markram was dismissed, South Africa had two new batters at the crease, in van der Dussen and Kyle Verreynne, and they needed time to get in. Five boundary-less overs followed, at a crucial stage in the chase, before van der Dussen swept through backward square leg. He played that shot, and the reverse sweep, almost exclusively and they brought him runs but not quickly enough. Verreynne was less productive, using 20 balls to score only 12 before he was out lbw.

Van der Dussen and Heinrich Klaasen combined for a partnership of 51 but were always playing catch up and when van der Dussen yorked himself playing the reverse sweep South Africa were all but out of the chase. Phehlukwayo was in at No. 7, which appears a spot too high for him - the length of South Africa's line-up will be another talking point. Sri Lanka's, on the other hand, looked more than long enough.

Fernando and Minod Bhanuka scored 41 runs off the first six overs against a pedestrian opening burst and runs only dried up with the introduction of Maharaj in the seventh over, and Markram in the tenth. The pair bowled eight overs in tandem and gave away only 25 runs. Crucially, they also took two wickets. Bhanuka was bowled by a Markram arm ball as he missed with a slog sweep and, four balls later, Bhanuka Rajapaksa became the only Sri Lankan batter to fail on the day, when he holed out to deep midwicket off Maharaj. Sri Lanka were 58 for 2 in the 13th over but South Africa were unable to keep the pressure on.

Phehlukwayo gave away the first boundary in more than 50 balls when he angled his first delivery down leg and Dhananjaya de Silva helped it to fine leg for four. de Silva lived dangerously thereafter, hitting Shamsi just over mid-off, where he evaded Phehlukwayo's outstretched hand, and was dropped on 30, when he offered a return catch to Shamsi, as the rain came down. A 25-minute delay gave de Silva, and South Africa, time to regroup, though it did not seem to do either much good. The batter was dropped again, on 33, when he got a thick edge off a late cut against Maharaj, but Klaasen could not hold on to a low chance. De Silva was eventually stumped by Klaasen after reaching out to sweep Maharaj with his back foot just outside the crease.

By that point, Fernando had brought up his half-century with a single to midwicket and the time was right for the innings to get some impetus. Charith Asalanka provided it. He took on the spinners and collected 18 from the first 16 balls he faced, before Fernando freed his arms to hit a hard length Rabada delivery over deep backward square for the first six of the innings. When Rabada tried the legcutter, Fernando whipped it off his hips for four, and when Phehukwayo took pace off the ball, he drove him uppishly through extra cover. He reached his century with a single off Phehlukwayo, then plundered 13 off a Nortje over and seemed set to see Sri Lanka to the close, but was done by a Shamsi wrong 'un that he popped up to point.

The dismissal of his senior partner did nothing to slow Asalanka down. He reached a 51-ball half-century with two runs off Nortje and built on it as South Africa lost their way towards the end. Nortje's final over cost 15 runs as he finished with 0 for 69 and Rabada gave away six extras in his last two overs. It was too much for the batters, and always might have been, especially as the highest total successfully chased in a day-night game in the country is 288.

In the end, Sri Lanka have gained crucial points on the World Cup Super League table and have moved up to eighth, while South Africa have slipped down to 11th. They have only successfully completed one chase of a 270-plus score since 2018, when they beat Australia in an ODI in Bloemfontein at home, after being set such a target ten times.

Firdose Moonda is ESPNcricinfo's South Africa correspondent