Younus Khan and Asad Shafiq struck centuries to rescue Pakistan from a perilous position on day one of the second Test against South Africa at Newlands.
The pair launched an inspired counter-attack - sharing a record fifth-wicket partnership against South Africa in the process - after a new-ball blitz from the Proteas' pacemen had seen Pakistan reduced to just 33-4 early in the day.
Younus registered his 21st Test century and first in South Africa before being dismissed two overs before the close when on 111.
Shafiq (111 not out) joined him in three figures with his 12th boundary in the 80th over, and, alongside Sarfraz Ahmed, will look to continue his fine work on day two with Pakistan well placed on 253-5.
After skittling Pakistan for just 49 in the first Test triumph in Johannesburg, South Africa's seamers picked up where they left off with another strong start after captain Graeme Smith had opted to bowl first.
Nasir Jamshed (3) was dropped at gully in the eighth over but fell to the next ball when Vernon Philander found his edge and AB de Villiers claimed a simple catch behind the wicket.
Mohammad Hafeez scored the first boundary of the day off the 58th ball and moved along to 17 by the time Dale Steyn (1-34) found an edge which Smith claimed low at first slip.
Pakistan were hoping for one of Azhar Ali's vigils but he fared little better than his predecessors, falling for four when he aimed an airy drive at Morne Morkel.
Morkel (2-37) made it 33-4 just four balls later, spearing one at captain Misbah-ul-Haq's body and being rewarded with an awkward fend to Dean Elgar at short-leg.
But any hopes South Africa and their supporters had of making further inroads were dispelled by the stubbornness of Younus and Shafiq.
The right-handed duo added 219 for the fifth-wicket and both reached three figures in South Africa for the first time late in the day.
Younus grew in confidence as his innings progressed and went on the attack in the evening session - dispatching left-arm spinner Robin Peterson (0-85) for three sixes before reaching his landmark.
A thin inside edge from the veteran right-hander saw an lbw verdict overturned against Steyn in the opening over of the second new ball but another off Philander (2-45) ended in his demise when De Villiers pouched low down.
Shafiq, who struck 14 boundaries and one maximum, survived a tricky spell against the new ball at the end of the day and is now integral to Pakistan's hopes of posting a substantial first-innings total.