Hamels (14-6) won his third straight start, reaching a double-digit strikeout total for the 20th time in his career.
The left-hander limited the Brewers to three runs on eight hits while issuing a single walk as the Phillies notched their first win in a four-game series at Miller Park.
Jonathan Papelbon recorded the final four outs to collect his 27th save.
Milwaukee's Mike Fiers (6-6) gave up four runs on five hits over five full innings.
Gal Gadot cast as Wonder Woman for 'Batman vs. Superman'
Couple mistakenly served bag of cash at McDonald's drive-thru