The Phillies trailed 4-1 after three innings but began a comeback in the fifth when Ryan Howard stroked a two-out, two-run single against Rockies reliever Josh Roenicke (4-2).
Matt Reynolds came in to pitch and Frandsen greeted him by sending a dribbler up the third base line that died for an infield hit, driving in Martinez with the decisive tally.
B.J. Rosenberg (1-2) tossed a scoreless top of the sixth to earn the win and Jonathan Papelbon corralled his 32nd save for the Phillies, who took the opener 3-2 and completed a three-game sweep of Colorado.
Chris Nelson clouted a three-run homer and Dexter Fowler collected three hits for the Rockies.