Ahmed Shehzad blasted his third ODI ton, put Pakistan on top while their bowlers finished the game positively against the hosts, South Africa.
The Green shirts finally won a game after six consecutive defeats from the Proteas who lost a close encounter in the second Twenty20 at Cape Town.
The composed unit of South Africa continued with their winning streak against out of form Pakistani team which lost the consecutive T20 game at Dubai.
Khurram Manzoor plundered his maiden Test ton, the debutant Shan Masood dispatched fifty and shared a valuable opening partnership as Pakistan ruled the day.
A sterling unbeaten hundred from the run machine of South Africa, Hashim Amla, guided his team to a reasonable position in the opening Test against Pakistan.