In a low-scoring game, the home team proved too good for South Africa.
Namibia have beaten the Proteas in a first T20 clash between the nations in Windhoek on Saturday, winning by four wickets.
After winning the toss and opting to bat first, South Africa scored 134/8 in their 20 overs, with Jason Smith top-scoring with 31.
Rubin Hermann got 23 and Luan-dre Pretorius 22, while Quinton de Kock, in his return match after coming out of retirement, scored one.
Namibia replied with 138/6 in their 20 overs, reaching their target on the last ball of the innings. Zane Green top-scored with 30.
The best of the South African bowlers was Nandre Burger with 2/21 while Andile Simelane got 2/28.
Proteas bowler Gerald Coetzee picked up a pectoral injury during the game and will undergo scans before any decision is made on his involvement with the team in Pakistan.
The Proteas Test team start their two-match series with Pakistan on Sunday, in Lahore.