Joe Blanton (2-0) pitched five shaky innings to earn his first win since Aug. 2. Blanton allowed four runs and five hits in his 10th start since Philadelphia acquired him from Oakland.
Chad Durbin tossed two scoreless innings to protect a one-run lead. Three relievers got outs in the eighth and Brad Lidge finished for his 35th save in as many chances. Lidge put the tying runs on base, before escaping the jam by striking out Wes Helms and Jorge Cantu to end it.
Werth drove reliever Joe Nelson's first pitch off the brick batter's eye in straightaway center to put the Phillies ahead 8-4 in the seventh.
Pinch-hitter Cody Ross connected off J.C. Romero in the eighth to slice the deficit in half, but a trio of relievers got the last five outs.
Mike Jacobs also hit a two-run homer for Florida, his 31st.
The Phillies scored five runs off starter Anibal Sanchez (2-4) in the first two innings.
Chase Utley had an RBI single and Ryan Howard hit a run-scoring double for a 2-0 lead in the first.
Blanton struggled with his control in the second, walking Jacobs and Dan Uggla to start the inning. After Josh Willingham blooped a single to load the bases, John Baker hit a sacrifice fly. Uggla scored on Alfredo Amezaga's grounder to first to tie it at 2.
At least Blanton helped himself at the plate in the bottom half of the inning.
After Carlos Ruiz doubled to put runners at second and third, Blanton lined a sacrifice fly to right for his first career RBI. Rollins and Howard had RBI singles to extend the lead to 5-2, but Jacobs hit his 31st homer to get the Marlins within a run in the third.
Notes: Struggling LF Pat Burrell was on Philadelphia's bench for the second time in three games. Burrell is batting .175 (21-for-120) with four homers and 13 RBIs since Aug. 1. He has 30 homers and 77 RBIs overall. ... Rollins passed Larry Bowa for fourth place on the club's all-time list with 289 steals. He's tied with Jim Fogarty. Rollins is 41-for-43 this season. ... Utley was hit by pitch for the 25th time, tying his single-season team record set last year. ... Marlins LHP Mark Hendrickson pitched 3 1-3 innings of scoreless relief to keep it close. ... Ross has four career pinch-hit homers.