Seattle prevented a three-game sweep thanks to yet another outstanding performance by the 2010 Cy Young Award winner.
Hernandez (12-5) produced his seventh victory in eight decisions, striking out nine and walking one. His earned run average dropped to 2.28, lowest in the American League.
Danny Farquhar allowed only a two-out single in the ninth on the way to his fourth save.
Dustin Ackley scored the first run in the third inning when he came in on a wild pitch thrown by Wily Peralta.
Peralta (8-12) went the distance while giving up just four hits. It was his second complete game of this season and for his career.
Justin Smoak added a homer in the fifth, his fourth long ball in 11 games.