PHILADELPHIA -- This was vintage Pedro.
Martinez (3-0) struck out a season-high nine in his fifth start since signing with the Phillies during the All-Star break, allowing one run and five hits. He didn't walk a batter and threw just 87 pitches in his longest outing since last Aug. 21 with the New York Mets.
"I flashed back to the good old times," Martinez said. "I don't have the power I used to have, but I always said it's not about power, it's about hitting your spots."
Jayson Werth homered for the NL East-leading Phillies, who are 16-6 since getting swept by Florida at home last month.
Eugenio Velez hit a leadoff homer for the Giants, who remained one game behind Colorado in the NL wild-card race.
The 37-year-old Martinez, plagued by injuries and inconsistency during his last three seasons with the Mets, looked like the guy who won three Cy Young Awards and was one of the most dominant pitchers of his generation.
Martinez had plenty of pop on his fastball, often reaching the low 90s on the radar gun, and mixed in an effective changeup.
"He had a little more life on his fastball, good movement and he had good command," Giants manager Bruce Bochy said. "He used his changeup well. I will admit he had a little bit more life than I thought."
Lincecum (13-5) was the tough-luck loser for the Giants, who've scored the second-fewest runs in the NL. Lincecum struck out 11 in seven innings, allowing two runs and four hits. It was the seventh time this season the reigning NL Cy Young Award winner gave up two earned runs or less and didn't get a win.
"He reminds me a little bit of me, but he's twice as good as me at this time of my career," Martinez said of Lincecum. "It took me seven years to win a Cy Young."
Lincecum was equally impressed.
"It's ridiculous how nasty his stuff still is," he said. "When you watch him, it's obvious he knows what he's doing out there."
Despite scoring just three runs in the series, the Phillies took two of three against San Francisco in a potential postseason preview. They beat the Giants 1-0 in the series opener behind a two-hitter by Cole Hamels. Brad Penny tossed eight scoreless innings in his Giants debut, helping San Francisco win 4-0 Wednesday.
Lincecum got into trouble when he drilled Chase Utley in the back with a fastball with two outs in the sixth. Howard then ripped a liner to right-center to put the Phillies ahead 2-1.
Velez hit Martinez's first pitch into the seats in right-center for his first career leadoff homer.
Werth drove a 3-2 slider a few rows deep into the upper deck in left in the second. The All-Star outfielder became the 22nd Phillies player to hit 30 homers in a season with his 435-foot drive.
Lincecum has allowed just nine homers this season and Werth was the second right-handed hitter to connect off him.
"If a guy makes a mistake, you have to capitalize on it," Werth said.
Martinez settled in nicely after Pablo Sandoval's one-out double in the first. He retired 13 consecutive batters before Aaron Rowand singled with two outs in the fifth. Martinez fanned seven of eight batters at one point. He struck out the side in the third, firing a 91 mph fastball past Edgar Renteria to end the inning.
The Giants wasted Velez's leadoff double in the sixth. Renteria grounded out to shortstop, Sandoval bounced to second and Bengie Molina lined to center.
- Phillies RHP Brett Myers will travel with the team to Houston and expects to be activated for the series. He hasn't pitched since hip surgery in June. Myers, the team's opening-day starter the last three seasons, will pitch out of the bullpen. He had 21 saves as a closer in 2007 and could spell Lidge when necessary. "I wish him well and I'm pulling for him every night," Myers said. "If he's sore one day or he's thrown three days in a row or something, there's plenty of guys down there that can jump in that spot and do it. I don't necessarily have to be the guy that does it, but it's always fun to do."
- Howard was named NL player of the month after batting .299 with 11 homers and 33 RBI in August.