It was far from an offensive eruption after the ineptitude shown the night before, but it was enough.

Sonny Gray, who finally got some run support, made sure of that.

One of the headliner acquisitions at the trade deadline turned in his best performance as a Yankee on Saturday afternoon, shutting down the Mariners for seven innings in a 6-3 victory in front of 39,810 at the Stadium.

“He’s done his job,” said Jacoby Ellsbury, who drove in four runs, three of them with a fourth-inning homer that made it 4-1. “It’s nice to give him, or any pitcher, an early lead. And I think it relaxed our offense a little bit.”

Gray (8-8, 3.26), allowed one run, three hits and two walks. The 27-year-old righthander, with a terrific curveball and slider, struck out nine in making it 11 straight starts in which he’s allowed two earned runs or fewer.

“I got my curveball and slider going early,” said Gray, whose biggest mistake was a flat 2-and-0 fastball Carlos Ruiz hit for a solo homer in the third to tie it at 1. “My fastball was kind of erratic early in the game but Ro [catcher Austin Romine] real ly got me back in it with my fastball. And both my breaking balls were good all day.”

Said Romine: “It was impressive movement I saw on the ball today . . . He made one mistake to Ruiz and after that, I don’t think he made another one. We know what we’re getting when he’s on the mound and we have a good chance to win.”

advertisement | advertise on newsday

Gray had been plagued by a lack of run support in his brief time in pinstripes, entering the day 1-3 with the Yankees but with a 3.13 ERA in four previous starts.

The Bombers, who went 0-for-12 with runners in scoring position in Friday night’s 2-1 loss in 11 innings, went 3-for-10 with RISP on Saturday. Ellsbury delivered two of them, an RBI single in the second to make it 1-0, and the three-run homer, which Gray called the game’s “turning point.” Starlin Castro, who returned from the DL on Friday night, had the other, a two-out, two-run single in the seventh to make it 6-1.

Overmatched Seattle starter Yovani Gallardo (5-10, 5.78) allowed four runs, four hits and five walks in 5 2⁄3 innings.

“For me, I’m trying to go out there and put a zero whether that happens or not,” Gray said of the Ellsbury blast. “But at the same time, it kicks you in the butt a little bit to go out there and get three outs.”

The Yankees (69-59), who saw Greg Bird play in a big-league game for the first time since May 1 (the 24-year-old went 1-for-2 with two walks), climbed within 3 1⁄2 games of the Red Sox in the AL East.

Yankees videos

The cushion Castro provided was needed as Joe Girardi went to Chasen Shreve in the eighth. The lefthander allowed a leadoff double to pinch hitter Danny Valencia, and watched as Chase Headley booted Nelson Cruz’s grounder for an error. After Kyle Seager’s RBI single made it 6-2, righty Tommy Kahnle came on. Kahnle, who helped spark Thursday’s fight club afternoon in Detroit by throwing behind Miguel Cabrera, struck out Mitch Haniger and got former Yankee Ben Gamel to ground into a 6-4 force. Guillermo Heredia came through with a two-out single to make it 6-3 but Kahnle got pinch hitter Robinson Cano to ground to second for the third out.

Dellin Betances pitched a perfect ninth for his 10th save.

Girardi thought it was a significant rebound by his team to beat a Mariners team very much alive in the AL wild-card hunt at 66-64.

“We put some runs up in Detroit and then we got shut down yesterday and had a lot of opportunities,” Girardi said. “To bounce back I think was important. Now you try to win the series tomorrow.”