Lopez put Seattle in front with a solo homer in the second and hit a two-run shot in the sixth. He ran his home run total for the year to eight.
Hernandez (6-3) allowed a run on seven hits and struck out five before giving way to Sean White in the eighth. White worked a perfect inning and David Aardsma struck out one in a 1-2-3 ninth for his 10th save.
Jeremy Guthrie (4-6) gave up three runs in six innings to take the loss. In his previous outing, Guthrie survived only 2/3 of an inning while getting pounded by Oakland for six runs on seven hits.
Seattle won just two of 10 games against Baltimore last season, but has already defeated the Orioles three times this year.