Sri Lanka got off to a sizzling start after winning the toss and electing to bat, but the introduction of Razzaq stemmed the flow of runs with the right-arm seamer taking 4-50, helping Pakistan dismiss Sri Lanka for 253 off 49.2 overs.
26-year-old Razzaq then came in to bat with Pakistan looking shaky at 201 for 6, blasting 38 off 24 balls including two fours and two sixes to win the match in a closing stand with the unbeaten Shoaib Malik who steadied the innings with 46 off 59 deliveries.
Pakistan, who sent fast bowlers Shoaib Akhtar and Mohammad Asif home earlier this week after they failed a drugs test, began well in their chase with opener Mohammad Hafeez hitting a quick fire 22 from 15 balls, with support from fellow opener Imran Farhat who batted well for 53 off 64.
Hafeez was the first to go when he was caught by Sri Lankan keeper Kumar Sangakkara off the bowling of Chaminda Vaas, with Pakistan captain Younis Khan also being caught behind off medium-fast bowler Farveez Maharoof for 7.
The introduction of spin undid Farhat, when he skied a Muttiah Muralitharan delivery to Dilhara Fernando, before Mohammad Yousuf anchored the middle of the innings with 49 off 92 balls.
The big hitting Shahid Afridi contributed little as he was caught by Upul Tharanga for 1 off the bowling of Sanath Jayasuriya, with the Pakistanis finding themselves in a slide when Yousef was needlessly run out to make the score 161 for 5.
Wicketkeeper Kamran Akmal chimed in with 20 off 28 balls before he was well caught by a back pedaling Maharoof off Vaas to give Pakistan a scare at 201 for 6, but it was Razzaq's night as he plundered the Sri Lankan bowling to lead his side to a morale boosting win.
Jayasuriya off to a flyer
Earlier, Sri Lankan openers Tharanga and Jayasuriya took advantage of the absence of Akhtar and Asif, hammering new ball bowlers Rana Naved and Rao Iftikhar for an opening stand of 63 off just 9 overs.
Bowled over: Sanath Jayasuriya
is out after scoring 48 off 35
Jayasuriya was playing in his 368th one-dayer, joining India's Sachin Tendulkar as joint-record holder for one-day international appearances and showed that experience pays off in his exciting innings of 48 off 35 balls.
37-year-old Jayasuriya was finally bowled by Iftikhar Anjum, with Razzaq taking the key wicket of Tharanga (38 off 48), who was beginning to look dangerous.
The Sri Lankan middle order looked good, but no batsman went on with the job – captain Mahela Jayawardene (31), Sangakkara (39), and Marvan Atapattu (36) all getting starts but failing to capitalise.
Pakistan did well to tie up the Sri Lankan tail, allowing just 40 runs off the final ten overs with Mohammad Hafeez bowling a tidy spell, taking 1-24 off seven overs.
Sri Lanka now play first-up winners New Zealand in Mumbai on October 20, while Pakistan have a break before also playing New Zealand in Chandigarh on October 25.