"It was a fun game overall," Gray said after his first victory for the Yanks.
Not so much for Chapman.
Chapman gave up an infield single to pinch hitter Jose Reyes and a two-run homer to rookie Amed Rosario in the ninth inning, then got two more outs for his 16th save in 20 chances. In his previous appearance, he blew a ninth-inning chance on Sunday night and took the loss against American League East-leading Boston Red Sox.
After throwing his last pitch in this one, Chapman grimaced as he broke to cover first base for the final out and came up hobbling a bit at the end of the play.
Speaking through a translator, Chapman said his hamstring tightened up but added, "It's nothing to worry about."
Yankees manager Joe Girardi said no tests were scheduled.
Chapman has allowed runs in three straight games, and Girardi said the hard-throwing lefty is probably frustrated and "searching" for answers.
Despite Chapman's stumble, the Yankees kept the Empire State Building lit up in pinstripes with the win. The Mets will try to change the color scheme to blue and orange as the matchup shifts to Citi Field for two games beginning Wednesday night.
Gray (7-7) earned his first win in three starts since being traded from the Oakland Athletics to a playoff contender. He blanked the Mets on four singles until the seventh inning, when he issued a leadoff walk and rookie Dominic Smith followed with his first major league homer.
Making his Yankee Stadium debut for his new team, Gray left to a nice ovation as reliever Tommy Kahnle was summoned.
"It was a great atmosphere," Gray said. "The crowd's into it, the players are into it."
DeGrom (13-6) gave up more than four earned runs for the first time in 12 starts. The righty exited after Sanchez hit a long sacrifice fly in the eighth. DeGrom showed no ill effects from a line drive to the pitching arm that finished his last outing.
"It's frustrating. You make decent pitches and they get hits on them," deGrom said. "They just did a good job and beat me."
DeGrom recorded his 100th big league appearance, all of them starts for the Mets. He made his debut in 2014 against the Yankees, and the first hit he allowed that night was a double by Ellsbury.
This time, Ellsbury lined a two-run drive into the right-field seats for a 3-0 lead in the fourth.
Sanchez opened the sixth with his 21st homer, topping his total from last year's rookie campaign. He connected for the second straight night against the Mets. He has four homers in the past seven games.
Yankees star Aaron Judge was presented a WWE championship belt by wrestling stars Braun Strowman, Big Cass and Alexa Bliss a couple of hours before the game, in recognition of winning the All-Star Home Run Derby last month in Miami.
"Wear it up to the plate tonight," suggested Yankees fan Cass, a few inches taller than the 6-foot-7 Judge.
"I might have to," the rookie slugger said.
Judge returned the favor, giving the trio customized Yankees jerseys.
Strowman is on the card Sunday for the popular SummerSlam event in Brooklyn. His father was a heralded slo-pitch softball hitter, and the brawny Braun said he had launched some long home runs too. "I've hit a couple of creatures in my day," he said.
Todd Frazier's bat slipped out of his hands on a swing in the eighth and helicoptered past Mets third baseman Wilmer Flores. The bat landed directly on the chalk foul line, and umpire Todd Tichenor playfully signaled fair.
Judge has struck out in 32 straight games, four off the record for a position player, set by Adam Dunn from 2011 to 2012. Rosario hasn't walked yet in 14 games, spanning 48 plate appearances. Which rookie will end his string first?
The Mets acquired OF Travis Snider from Texas for cash and sent him to Triple-A Las Vegas. He last played in the majors in 2015 with Pittsburgh and Baltimore. He was hitting .294 with nine homers and 44 RBIs this year at Triple-A Round Rock. The Mets also signed RHP Neil Wagner to a minor league deal. He most recently was in the majors in 2014 with Toronto.
Mets: RHP Noah Syndergaard threw 20 pitches off the bullpen mound before the game and later said, "This is the best I've ever felt." It was his first time on a mound since tearing his lat on April 30. ... RHP Matt Harvey (shoulder) is set for his second rehab outing on Wednesday for Class A Brooklyn. He threw 18 pitches in his first outing. ... RHP Jeurys Familia is set to pitch Wednesday for Class A St. Lucie. It will be his first rehab appearance since having surgery for a blood clot in his shoulder.
Yankees: LHP CC Sabathia (knee inflammation) will throw another bullpen session on Wednesday, and if he's OK, he could start this weekend at Boston. ... 1B Greg Bird (ankle surgery) will play five innings on Wednesday at Triple-A on his first rehab assignment.
Mets: RHP Robert Gsellman (hamstring) will come off the disabled list to start versus the Yankees on Wednesday night at Citi Field. He was 5-5 with a 6.16 ERA before he was injured in late June. He'll pitch in place of RHP Seth Lugo, who was put on the 10-day DL with a right shoulder impingement.
Yankees: LHP Jaime Garcia is 1-1 with a 5.82 ERA in two starts for the Yankees. He is a combined 5-8 with a 4.50 ERA this year in 21 starts for Atlanta, Minnesota and New York.
Fantasy baseball pitcher rankings, lineup advice for Sunday's MLB games
Everything you need to know to place your MLB bets and set your fantasy baseball lineups for Sunday, August 14.
Marlins to break losing streak in game against the Braves
Atlanta Braves (69-46, second in the NL East) vs. Miami Marlins (50-64, fourth in the NL East)
Dodgers play the Royals after Muncy's 4-hit game
Los Angeles Dodgers (79-33, first in the NL West) vs. Kansas City Royals (47-68, fourth in the AL Central)
Red Sox and Yankees meet, winner claims 3-game series
New York Yankees (72-42, first in the AL East) vs. Boston Red Sox (56-59, fifth in the AL East)
Cardinals and Brewers meet with series tied 1-1
Milwaukee Brewers (61-51, second in the NL Central) vs. St. Louis Cardinals (62-51, first in the NL Central)
Angels and Twins meet in series rubber match
Minnesota Twins (58-54, second in the AL Central) vs. Los Angeles Angels (50-64, fourth in the AL West)