Shamsi recorded figures of 1-11 in four overs to stall the West Indies victory charge as the hosts attempted to chase down South Africa's score of 168 for four, but were restricted to 143 for nine as the tourists claimed the series 3-2.
Shamsi has been excellent in all five games, conceding just 80 runs at an economy rate of four per over against a powerful home batting line-up at the small venue in St George's.
Evin Lewis (52 from 34) gave West Indies a fast start to their chase, but the remainder of the batting line-up struggled to score at his rate and they soon fell off the pace, leaving too much to do in the final few overs.
Seamer Lungi Ngidi saved his best performance for the last game in the series as he recorded figures of 3-32.
After choosing to bat, South Africa's innings was propelled by a 128-run partnership between Quinton de Kock (60 from 42 balls) and Aiden Markram (70 from 48 balls), a record for the tourists for any wicket against West Indies.
But as has been the case throughout the series, they too struggled to finish well, scoring just 32 runs in the final five overs of the innings despite having wickets in hand.
Seamer Fidel Edwards was the pick of the home bowling attack with 2-19 from three overs.