PHILADELPHIA (AP) -- Greg Maddux stomped off the mound, took his glove off and nearly slammed it to the ground. He was agitated a pitcher got a hit off him.
Hamels pitched 7 1/3 impressive innings and the Philadelphia Phillies beat the Padres 7-4 on Tuesday night, denying Maddux his 350th career victory.
"It's nice because he's a guy I grew up with and idolized," Hamels said. "And to get a hit off him is pretty special."
Hamels (3-3) allowed five hits, two runs and struck out six. Tom Gordon worked out of a bases-loaded jam in the eighth and the Phillies scored four insurance runs in the bottom half.
Maddux (2-2) gave up three runs and eight hits in 6 1/3 innings. The four-time Cy Young Award winner was trying for the third start to become the ninth pitcher in big-league history to reach 350 wins.
"It doesn't weigh," Maddux said. "It's not a milestone. It really isn't. Trust me, I've been on extra credit for five or six years now. I've stopped pitching for results. I'm just going out there to see how long I can do it."
Scott Hairston hit a pair of homers for San Diego.
Hamels was sharp from the start. Mixing in a changeup and a crisp fastball, the left-hander retired 11 of the first 12 batters before Adrian Gonzalez singled to right in the fourth for San Diego's first hit. Gonzalez was thrown out by Geoff Jenkins trying to stretch it into a double.
"He mixed his pitches and was aggressive with his fastball," manager Charlie Manuel said. "Cole didn't make too many mistakes."
Hairston got the Padres within 2-1 when he connected for a solo shot in the fifth. He hit a two-run shot off Ryan Madson in the ninth.
Hamels singled to chase Maddux and help the Phillies regain a two-run lead in the seventh.
After Ruiz singled with one out, Hamels stroked a single to right to put runners at first and third. Maddux wasn't too pleased, and it didn't make him any happier when manager Bud Black came out and called for Cla Meredith.
"I pitched just good enough to lose," Maddux said.
Jayson Werth's sacrifice fly scored Ruiz to make it 3-1.
Hamels left after a one-out walk in the eighth put runners at first and third. J.C. Romero entered and walked his only batter, pinch-hitter Tony Clark. But Gordon preserved the lead. Tadahito Iguchi's groundout scored a run to cut it to 3-2. Gordon then retired Kevin Kouzmanoff on a grounder to leave runners at second and third.
"Cole pitched wonderful," Gordon said. "It's great I was able to help."
Hamels has pitched at least seven innings in each of his six starts. He allowed three runs in his first three outings but nine runs in the last two.
"I joke around about not getting through the eighth," Hamels said. "It's something I have to work toward. It's hard enough to get to the eighth and harder to finish it."
Hairston's other two-homer game was against the Giants on Aug. 3, 2007. ... Phillies center fielder Shane Victorino came off the disabled list. He was sidelined since April 12 with a calf strain. ... Maddux is 29-18 lifetime against the Phillies. ... Philadelphia is 11-8 without injured Jimmy Rollins. The 2007 NL MVP will miss another week with an ankle injury.