Ellsbury got the Yankees on the board first in the bottom second as he drove a single up the middle to score Starlin Castro. After Carlos Ruiz launched a solo homer in the top of the third, Ellsbury answered an inning later.
With two on, he lifted one over the right field wall to give the Yankees a 4-1 lead. Ellsbury would finish the day 2-for-4 with four RBI.
Gray was dealing as his only blunder was the Ruiz home run. He allowed only two more hits while striking out nine and walking two in seven innings.
Castro added some insurance with a two-RBI single in the bottom of the seventh. He finished the day 1-for-3 with a walk as well.
Dellin Betances recorded a 1-2-3 ninth inning for his 10th save of the year.
The Yankees play the rubber game of a three-game series with the Mariners at Yankee Stadium on Sunday at 1:05 p.m. Masahiro Tanaka (9-10, 4.86 ERA) will face Andrew Albers (2-0, 3.60 ERA).