Hernandez (12-5) struck out nine and walked one in his first career appearance against the Brewers. The 2010 AL Cy Young winner leads the league with a 2.28 ERA and is second with 178 strikeouts.
This was the eighth time this year that he pitched at least eight innings.
Hernandez improved to 16-7 with a 2.63 in 30 career interleague starts, including 3-0 with a 1.16 ERA in four starts this season.
Danny Farquhar worked the ninth for his fourth save.
Wily Peralta (8-12) pitched a complete game and allowed four hits. He walked none and struck out four.
Justin Smoak hit a solo home run in the fifth, his 13th.
The Mariners, who lost the first two games in the series, ended a 12-inning scoreless streak with a gift run in the third.
Dustin Ackley opened with a double to left and moved to third on Brendan Ryan's right-side groundout.
On a 1-0 pitch to Henry Blanco, Peralta bounced a fastball in front of the plate. The wild pitch caromed off catcher Martin Maldonado's shoulder and rolled several feet away. Ackley sprinted home for a 1-0 score.
NOTES: Mariners manager Eric Wedge, who has missed 18 games recovering from his July 22 mild stroke, visited the team before the game. He said he hopes to manage again when the team returns for its next homestand Aug. 23. ... Acting manager Robby Thompson said Mariners pitcher Hisashi Iwakuma "jammed" his back Saturday against the Brewers. "I talked to him a little bit. He said he was fine. He should be good to go," Thompson said. ... The Brewers this weekend became the final Major League Baseball team to play a regular-season game at Safeco Field. Before Friday, the last time Milwaukee played a regular-season game in Seattle was Aug. 12, 1997, at the Kingdome. ... The Brewers' franchise actually began in Seattle. After one season as the expansion Seattle Pilots, the club moved to Milwaukee to play as the Brewers in 1970.