Nepal came to within two runs of a famous victory over South Africa as the Proteas edged a thrilling encounter in Kingstown to remain unbeaten at the T20 World Cup.

Sompal Kami knew that two runs from the final ball of the match would secure an unlikely triumph, but batting partner Ghulsan Jha was run out at the non-striker's end to conclude their first meeting in international cricket.

South Africa were restricted to 115-7 with opener Reeza Hendricks producing 43 runs from 49 balls, ultimately handing the initiative to their opponents to keep their Super 8s hopes alive.

Nepal would last until the eighth over before losing Kushal Bhurtel and Rohit Paudel in three balls, but the Rhinos would steady the ship, leading to a nail-biting finish.

However, Tabraiz Shamsi (4-19) struck twice in a game-changing 18th over, aided by Ottniel Baartman denying seven runs in the final over to decide the tie.

South Africa face the United States in Antigua on June 19, while Nepal search for their first win of the tournament as they take on Bangladesh in their final Group D game.

Meanwhile, New Zealand secured their first win of their T20 World Cup campaign with relative ease, beating Uganda by nine wickets at the Brian Lara Cricket Academy.

The Black Caps exit from the tournament had already been confirmed following Afghanistan's seven-wicket triumph over Papua New Guinea, exiting a World Cup before the last four for the first time since 2014.

Trent Boult dictated the early pace of the encounter, taking two wickets inside the first over as their opponents quickly saw five wickets fall for just 15 runs.

Kenneth Waiswa was the only batter for the Cricket Cranes to reach double figures, as wickets from Tim Southee (3-4) and Mitchell Santer (2-8) in successive balls saw Uganda all out for 40.

Kane Williamson's side faced just 33 balls on their way to victory, as Devon Conway scored an unbeaten 22 from 15 balls to win the contest ahead of their final Group C fixture against the Barramundis.