Hamels (7-5) gave up only one run, four hits and walked none while striking out nine Arizona batters. He won back-to-back starts for the first time since June 4.
Haren (10-6), who entered with an NL-low 2.14 ERA, lost for only the second time since May 12.
The Diamondbacks struck first when second baseman Ryan Roberts knocked a solo shot off Hamels in the bottom of the first. But the Phils struck back with a Shane Victorino solo homer in the top of the third.
In partnership with NBC Sports Philadelphia
The “Flyin' Hawaiian” drove in another run to put the Phillies ahead for good in the fifth inning.
The Phillies had to survive a shaky ninth inning by Brad Lidge, who gave up a two-run homer to Mark Reynolds on his way to picking up his 20th save in 26 chances.
The game was played inside Chase Field in Phoenix, Ariz. The temps outside the dome reached as high as 114 degrees Tuesday.
The Phils are on a 19-3 run overall and the NL East leaders improved to a majors-best 19-5 in July.
So you could say that the only thing hotter than the weather in Phoenix right now is the Phightins. They go for the sweep Wednesday.