After watching Jon Gray walk two of three batters to load the bases with none out in the second inning, Chase Headley had a feeling he’d see a fastball from the righthander.

“He’s got great stuff, so you know he wants to get ahead,” Headley said. “I was looking for a pitch I could handle in the middle of the plate, and I got a fastball I could hit.”

That fastball came in at 97 mph and Headley sent it into the netting that overhangs Monument Park in centerfield. The Yankees’ first grand slam of the season — and the fourth of Headley’s career — produced a 4-0 lead.

It was the continuation of an impressive stretch for Headley, who had a .305/.371/.453 slash line in his previous 38 games.

“I think it’s a little mechanical issue that they were able to work out,” Joe Girardi said of Headley and hitting coach Alan Cockrell.

Refsnyder earning Girardi’s confidence

advertisement | advertise on newsday

Rob Refsnyder’s bat continues to make him more than a platoon player. For the second straight game, he started at first base against a righthander, leaving lefthanded-hitting Ike Davis on the bench. Refsnyder went 1-for-2 with a walk, giving him a .288/.345/.404 slash line in 20 games.

“His at-bats have been good,” Girardi said before the game. “I think he’s an outstanding baserunner. I just like the way that he’s playing. It’s why I’m sticking with him right now.”

Davis was a defensive replacement in the ninth.

Yankees videos

Around the horn

Carlos Beltran matched last year’s home run total of 19 with his three-run shot in the seventh. The 39-year-old has a .339/.385/.706 slash line in his last 29 games . . . Brett Gardner went 1-for-3 with two walks and has reached base safely in nine of his last 13 plate appearances. He has a .432 OBP at home this season . . . Jacoby Ellsbury returned after a one-day absence because of a stomach virus and went 1-for-5, a double.