Hamels (13-6) allowed only one runner to reach as far as third base in the performance, during which he tossed 85 of his 113 pitches for strikes.
The left-hander scattered seven hits, issued one walk and struck out five as the Phillies claimed the opener of a three-game series.
Miami's Nathan Eovaldi (3-8) was tagged with the loss, though only two of the three runs he allowed through five innings were earned. He gave up eight hits.
'How to Train Your Dragon 2' releases 5-minute clip
Yosemite climber falls 30 feet, suffers major injuries