The tourists had reached 331-5 in their first innings by stumps on the third day, trailing Bangladesh's total of 433 by 102.
Masakadza made the most of the home team's sloppy fielding to hit 17 fours and two sixes after starting the day on 15.
He was dropped thrice by the same fielder, Shamsur Rahman, in the slips when on 15, 19 and 74. Rubel Hossain, Taijul Islam and Shakib Al Hasan were the unlucky bowlers.
Masakadza, who made just one half-century in six previous Test innings in Bangladesh, shared an unbroken stand of 142 with Regis Chakabva (75 not out) for the sixth wicket.
Chakabva was on four when Bangladesh captain Mushfiqur Rahim missed a simple stumping off Shakib. When he reached nine, the batsman was reprieved by the Decision Review System after being given out leg-before off Shakib.
Masakadza celebrated his fourth Test century with a boundary off Shakib through the third man region.
Shakib, bowling steady left-arm spin, picked up the wickets of Brendan Taylor (37), Craig Ervine (17) and Elton Chigumbura (one) in the post-lunch session to reduce Zimbabwe to 189-5.
But Masakadza and Chakabva defied the spinners in the entire final session to lead a spirited fightback.
Bangladesh lead the three-match series after winning the first Test in Dhaka by three wickets last week.
The third Test between the two lowest-ranked teams -- Zimbabwe at number nine and Bangladesh at 10 -- will be played in Chittagong from November 12-16.
Scorecard
Bangladesh 1st innings: 433
Zimbabwe 1st innings (Overnight 53 for 1)
S Raza lbw b Taijul 11
B Chari c Tamim b Taijul 25
H Masakadza not out 154
B Taylor c Mominul b Shakib 37
C Ervine c Rahim b Shakib 17
E Chigumbura c Mominul b Shakib 1
R Chakabva not out 75
Extras: (B-2, LB-7, W-1, NB-1) 11
Total: (For five wkts; 112 overs) 331
Fall of wickets: 1-17, 2-84, 3-151, 4-181, 5-189.
Bowling: Shahadat 11-2-24-0, Taijul 30-6-94-2, Shakib 30-6-70-3, Jubair 18-2-63-0, Rubel 13-4-31-0 (w1), Shuvagata 7-0-27-0, Mominul 1-1-0-0, Mahmudullah 2-0-13-0.
Image: Hamilton Masakadza
Photograph: Touchline Photo/Getty Images
Tamim, Shakib hit tons as Bangladesh dominate Day 2
Taijul's 8-wkt haul gives Bangladesh dramatic win over Zimbabwe
Cricket Buzz: England's Bresnan ruled out of India Twenty20 game
Test Rankings: Ashwin continues to top all-rounders list
Five-star Roach has Bangladesh struggling again