Set to chase a revised target of 123 in 17 overs, South Africa achieved the total when Jansen hit Obed McCoy for a six, earning a three-wicket victory on DLS with five balls to spare.
Initially, South Africa needed to chase a 136-run target and Quinton de Kock gave his side a good start as he struck Akeal Hosein for three boundaries in the first over.
However, Andre Rusell pulled things back as he got Reeza Hendricks out for a golden duck on the first ball of the next over.
Meanwhile, De Kock (12) fell on the last ball of the same over, leaving South Africa at 15-2 at the end of the second over.
Alzarri Joseph removed South African skipper Aiden Markram (18) before Heinrich Klaasen struck a 10-ball 22 with three boundaries and one six. However, Joseph got Klaasen caught behind to force West Indies’ comeback.
With 46 required from 54 balls, Tristan Stubbs and David Miller helped stabilize the innings with their cautious approach.
The situation soon came down to 31 needed off 36, but Roston Chase turned the game around with his off-spin bowling.
Chase castled Miller (4) and gave away only one run in his first over, followed by the wicket of Stubbs in his next over. Stubbs top-scored for South Africa with 29 off 27.
Jansen on the other hand kept the scoreboard moving, bringing the required run-rate to 6.5 in the last two overs.
Keshav Maharaj (2) fell to Chase in the penultimate over, however, Kagiso Rabada struck a boundary on the last ball of the over to tilt the game in South Africa’s favor.
With five required off six, Jansen finished the match in style with a six over the long on to clinch the nail-biting victory. The all-rounder scored an unbeaten 21 off 14 with one six and one four.
For West Indies, Chase returned with figures of 3-12, while Russell and Joseph bagged two wickets each.
Earlier, South Africa opted to bowl first and reduced West Indies to 5-2 in 1.1 overs, with Marco Jansen and skipper Aiden Markram claiming a wicket each.
Kyle Mayers and Roston Chase then constructed an 81-run partnership off 65 balls to help West Indies recover from the early blows.
Shamsi then struck on the last ball of the 12th over to break the partnership, dismissing Mayers, who scored a 34-ball 35 with three boundaries and two sixes.
South Africa dominated from there as West Indies lost wickets quickly, slipping from 86-3 to 97-6 with Chase being the sixth batter to return to the pavilion.
Chase scored 52 runs from 42 balls with the help of three boundaries and two sixes.
Andre Russell played a 15-run cameo, while Gudakesh Motie scored an unbeaten 11 off 7 to push the team’s total to 135-8 in 20 overs.
Shamsi was the pick of the bowlers, while Jansen, Markram, Keshav Maharaj, and Kagiso Rabada claimed one wicket each.