Pakistan, who won the toss and chose to bat, reached tea on 160 for two.
Hameed was 53 not out with Khan on 55, and their partnership for the unbroken third wicket was worth 110.
South Africa's only successes came shortly after the first drinks break when fast bowler Makhaya Ntini, who took two for 39, removed openers Imran Farhat and Mohammad Hafeez in consecutive overs.
The openers put on 48 before Farhat cut uppishly and was caught by Hashim Amla at point for 26.
In Ntini's next over Hafeez, who scored 19, attempted to leave an angled delivery and gloved a catch to wicketkeeper Mark Boucher.
South Africa might have dismissed Farhat for 14 in the 12th over with the total on 26 without loss when he top-edged a hook off fast bowler Andre Nel.
Paul Harris circled under the ball at mid-on, but failed to lay a hand on what seemed a routine catch.
Boucher became the fourth South African after Shaun Pollock, Jacques Kallis and Gary Kirsten to earn his 100th test cap on Thursday.
Fast bowler Dale Steyn, who suffered a recurrence of a thing strain in the third test against India in Cape Town, was replaced by Nel in the only change to the South African team.
Mohammad Asif is playing his first match for Pakistan since he and fellow fast bowler Shoaib Akhtar were banned in November for doping offences.
A tribunal later cleared both players.
Pakistan 160 for 2 (Yasir Hamid 53 n o, Younis Khan 55 n o, Farhat 26; Ntini 2 for 39) Vs South Africa