Pinch-hitter Ryan Howard also went deep, hitting a tying solo shot off Chad Qualls that ignited a five-run seventh. Michael Stutes (5-1) allowed one run in 1 1-3 innings in relief of Kyle Kendrick, and Ryan Madson finished for his 17th save in 18 chances.
Cameron Maybin and Chase Headley hit homers for the Padres, who haven't beaten the Phillies since last June 7. They were swept by Philadelphia in a four-game series in San Diego in April.
Qualls (4-5) had allowed just one homer this season in 48 1-3 innings before the Phillies hit three. He gave up five runs and four hits while retiring just one batter.
Padres starter Mat Latos pitched well except for one mistake to Utley. He allowed three runs and five hits in six innings, striking out seven.
Maybin's RBI single in the seventh off Stutes put the Padres up 4-3. Logan Forsythe led off with a triple high off the scoreboard fence in right. Stutes struck out Rob Johnson and retired pinch-hitter Jesus Guzman on a popup. But Maybin hit a hard one-hopper off diving shortstop Jimmy Rollins' glove to knock in the go-ahead run.
Howard then hit the first pitch from Qualls into the seats in left-center to tie it at 4. Pinch-hitter Ross Gload followed with a double down the right-field line. After Rollins walked, Martinez fouled off two bunt attempts. The runners moved up on a wild pitch, so Martinez got the green light to swing away.
He ripped a drive into the seats in right for his second career homer - his first was a three-run shot last Sunday at the New York Mets - to give the Phillies a 7-4 lead. Martinez, a Rule 5 pickup, has filled in nicely for injured All-Star third baseman Placido Polanco. He's batting .294 (15 for 51) with 15 RBIs in his last 13 games.
Utley chased Qualls with a solo homer that made it 8-4. It was his 19th career multihomer game and first this season.
Antonio Bastardo allowed a run in the eighth and left with the bases loaded and two outs. David Herndon came in and walked pinch-hitter Alberto Gonzalez to force in a run that got the Padres within 8-6. But he retired Maybin on a bouncer to the mound to end the inning. Bastardo, who is 7 for 7 in save chances, entered with a 0.99 ERA and left at 1.46.
Kendrick was cruising with a two-hitter through five before running into trouble. Latos helped himself with a single to start the sixth. Maybin hit the next pitch just inside the foul pole in left to cut it to 3-2. One out later, Headley tied it with a drive into the left-field seats. Kendrick couldn't get out of the inning after giving up a two-out single to Kyle Blanks. He allowed three runs and six hits in 5 2-3 innings.
It was 100 degrees when the game started and it showed in the stands. Despite the 187th straight sellout, including postseason play, at Citizens Bank Park, there were plenty of empty seats in the upper levels.
Phillies manager Charlie Manuel rested Howard, so he switched his lineup up a bit. Shane Victorino batted third for just the second time all year and Utley hit cleanup for the first time. It paid off right away in the first inning.
Rollins led off with a double and Victorino walked with one out. Utley then ripped an opposite-field shot just over the flower bed beyond the left-field wall to give the Phillies a 3-0 lead.
Notes: Padres RF Will Venable was scratched from the lineup because of sore hamstrings. ... Howard wasn't in the starting lineup for just the third time this season. He was 2 for 25 since the All-Star break before hitting his sixth career pinch-hit homer. ... Maybin has a nine-game hitting streak and he's stolen a base in five straight. Only Dave Roberts (2006) and Alan Wiggins (1983) stole bases in that many consecutive games for the Padres. ... Forsythe's triple was his first in the majors. ...A Padres pitcher allowed three homers in an inning for the first time since reliever Brian Sweeney did it on July 26, 2006 in the eighth inning at San Francisco in a 9-3 loss.