Razzak's three-wicket salvo formed part of impressive five for 30 figures and concluded Bangladesh's dismissal of Zimbabwe for a paltry 191 before the hosts raced to 194 for four with more than 10 overs to spare to square the five-match series at 1-1.
Zimbabwe had won the first match by nine runs on Wednesday. Shakib bowled superbly to finish with four for 39 from nine overs of work, but Razzak overshadowed his skipper at the end of Zimbabwe's innings when he became the first left-arm spinner in ODI history to claim a hat-trick.
He had Prosper Utseya caught by Naeem Islam at long on for 32 from the last ball of his eighth over and returned to trap Raymond Price and Christopher Mpofu lbw with the first two balls of his next over to complete the hat-trick.
Craig Ervine was left stranded on 42 at the other end after staging a late recovery for Zimbabwe with a 57-run seventh wicket stand along with Utseya after Bangladesh had dominated with the ball.
Opener Tamim Iqbal gave Bangladesh a comfortable start with 44 off 48 balls before Zunaed Siddique and Roqibul Hassan each struck half-centuries to help finish off the job. The third match of the series, a day-nighter, will be held at the same venue on Monday.
Score Board
ZIMBABWE
Taylor c Raqibul b Shakib 28
Chibhabha c Rahim b Shafiul 1
Chakabva st Rahim b Razzak 21
Dabengwa c & b Shakib 30
Taibu lbw Razzak 21
Ervine (not out) 42
Chigumbura b Shakib 7
Utseya c Naeem b Razzak 32
Meth c & b Shakib 0
Price lbw Razzak 1
Mpofu lbw Razzak 0
Extras (LB-3, W-5) 8
Total (all out, 46.2 overs) 191
Fall of wickets: 1-10, 2-50, 3-56, 4-104, 5-114, 6-132, 7-189, 8-190, 9-191.
Bowling: Mortaza 3-0-17-0, Shafiul 5-0-28-1, Razzak 9.2-2-30-5, Shakib 9-0-39-4, Naeem 10-1-27-0, Shuvo 10-0-47-0.
BANGLADESH
Tamim c Mpofu b Price 44
Kayes c Taibu b Mpofu 10
Siddique st Taibu b Price 53
Raqibul st Taibu b Dabengwa 65
Shakib (not out) 9
Rahim (not out) 7
Extras (LB-2, W-4) 6
Total (for 4 wkts, 39.4 overs) 194
Fall of wickets: 1-26, 2-75, 3-147, 4-187.
Bowling: Utseya 8-0-50-0, Mpofu 7-0-31-1, Meth 4.4-0-32-0, Price 9-1-41-2, KM Dabengwa 7-0-17-1, Chibhabha 2-0-11-0, Taylor 2-0-10-0.