In a match reduced to 45 overs per side due to rain, Dale Steyn starred for South Africa with career-best ODI figures of six for 39 but Shehzad's third century for his country helped put Pakistan in a strong position at St George's Park.
The opener made 102 off 112 balls, striking eight fours and two sixes, before he was run out following a mix-up with Umar Akmal.
The tourists, who successfully defended 218 to win the opening match of the three-game series by 23 runs in Cape Town on Sunday, also had decent contributions from Sohaib Maqsood and Akmal, who both scored 42.
For South Africa, Steyn was undoubtedly the stand-out. The paceman took all but two of the wickets to fall to bowlers - with the other two dismissals being the run-out of Shehzad and that of Anwar Ali, who was out obstructing the field.
Steyn was quickly into his stride following a delayed start to the match due to the weather, as he sent back Nasir Jamshed (two) and Mohammad Hafeez (eight) early on.
That left the tourists on 22 for two after losing the toss but Shehzad and Maqsood joined forces in a third-wicket stand worth 124 to lead Pakistan's recovery.
That partnership ended when Maqsood tried to launch Ryan McLaren down the ground and succeeded only in picking out Hashim Amla at deep extra cover.
Captain Misbah-ul-Haq then came and went for 12, caught down the leg side off spinner Imran Tahir as Pakistan slipped to 176 for four, and just four runs later they lost centurion Shehzad.
The 22-year-old wanted a quick single but Akmal failed to move from the non-striker's end and by the time Shehzad turned around he was well down the pitch, and he was comfortably short as he tried to get back to the crease.
That was a hugely disappointing way for Shehzad to see an impressive innings come to an end, but he had laid the foundation for a decent score and Umar and Bilawal Bhatti (17) ensured Pakistan passed the 250-mark.
The match finished with three wickets falling in the final over off Steyn.
Ali was out obstructing the field as he blocked wicketkeeper Quinton de Kock's throw while running down the centre of the pitch, and then Steyn sent back Akmal and Saeed Ajmal in the space of three balls.
- Sports & Recreation
- Dale Steyn
- Umar Akmal