The match was reduced to a 44-over a side affair thanks to the rain at SuperSport Park and after South Africa was bowled out for 191 in just 43.2 overs with Irfan claiming an international best 4-33, Pakistan cruised to victory reaching 4-192 in just 39.2 overs.
The five-match series is now tied at 1-1 after South Africa cruised to victory in the first match in Bloemfontein. Game 3 will be played in Johannesburg on Sunday.
South Africa's openers Graeme Smith and Hashim Amla put on 26 for the first wicket before Amla fell for 17 from 16 balls when caught behind to become Irfan's first victim of the day.
The Proteas were then 2-26 the very next ball with Irfan on a hat-trick after also having the century-maker from Bloemfontein Colin Ingram caught behind for a first-ball duck.
South Africa continued to lose quick wickets with captain AB de Villiers soon gone for four also thanks to Irfan and then Smith was gone for 10 when caught behind by Kamran Akmal, this time off the bowling of Junaid Khan.
The home side was 4-43 and then 5-62 when Faf du Plessis was caught and bowled by Irfan for 17.
Farhaan Berhardien fought hard making 58 from 82 balls and received some good support with 17 from Ryan McLaren and 44 from Robin Peterson, but Pakistan's spinners Mohammad Hafeez and Saeed Ajmal then came into their own.
South Africa lost its last four wickets for just 18 runs to be bowled out for 191 failing to bat out the remaining four deliveries of the reduced 44-over innings.
While Irfan was the star with the ball for Pakistan with 4-33 from seven overs, all of the tourists bowlers did well with Khan taking 2-29, Ajmal 2-23 and Hafeez 2-35.
Pakistan needed 192 from 44 overs to level the one-day series and made solid progress right the way through its innings never looking likely to fall short of the total.
The first wicket fell at 29 when Nasir Jamshed was caught by Smith off McLaren for 10 and then his fellow opener Hafeez made 31 before being caught by Kyle Abbott of Dale Steyn.
Pakistan then fell to 3-69 when Akmal came and went for 18 bowled by left-arm spinner Peterson, but a 46-run fourth wicket stand with Younis Khan and captain Misbah-ul-Haq set up the visitors.
Younis was eventually out for a well-made 32 from 41 balls when caught by Amla off Peterson, but that was the last Pakistan wicket to fall with Misbah finishing not out on 57 and Shoaib Malik 35 not out from 38 balls with four boundaries and a six.
Peterson took some stick but finished with 2-52 from eight overs for South Africa with Steyn and McLaren picking up a wicket apiece.