Teammates greet Mets starting pitcher Jacob deGrom in the dugout after he hit a solo home run during the third inning. (Kathy Willens/Associated Press)

The Washington Nationals recognized the stiffest test of their four days in Flushing awaited them Sunday afternoon. He stood a lanky 6 feet 4, with a long, flowing mane under a powder blue New York Mets Father’s Day ball cap, and he was the reason Nationals Manager Dusty Baker stressed seizing the first three games of the series.

Jacob deGrom stood in the way of a Nationals sweep, of adding gravy to an emphatic response to an unsavory homestand, and he did not budge. The right-hander stifled Washington over eight brilliant innings as some misfortune derailed Joe Ross’s outing, and the Nationals took their first loss in seven games at Citi Field this season, 5-1.

The Nationals (42-27) scored an unearned run four batters into the game on Ryan Zimmerman’s sacrifice fly, but that was all they could collect against deGrom. Trea Turner had a hit, a walk and set a Nationals record with four steals, but the Washington offense posted just three hits and a walk otherwise against deGrom and right-hander Addison Reed. DeGrom pitched with multiple runners on base just once after that first inning, slugged his first career home run off Ross in the third, and ended his day after tossing an economical 105 pitches.

“You got to put it on deGrom,” Baker said. “We knew he was going to be tough going into today because they don’t want to be swept at home.”

Joe Ross turned in another up-and-down performance. (Kathy Willens/Associated Press)

DeGrom outlasted Ross, who battled the Mets (31-37) and a couple of bad breaks over six innings with a revamped change-up at his disposal. Ross’s inconsistency has emerged as one of the Nationals’ few worries outside their bullpen. Before Sunday, his outings vacillated between gems and debacles, with very little in between. The Nationals believe the extreme variation stemmed from a shifting arm slot, which they contend produces a flattened slider and limits his endurance. It’s the difference between Ross being lights-out and throwing batting practice.

Further, a flat slider presented a significant problem for Ross because he has relied heavily on just two pitches — the slider and a sinker — with the change-up a distant third in his arsenal. The limited repertoire granted him little margin for error. But Ross debuted a slightly different change-up Sunday, a slower one designed to create more discrepancy between it and his sinker. He threw 11 of them. Mets swung at seven and whiffed three times.

“It’s huge because when he can slow it down to the speed that he had today, the hitters have to make a conscious effort to be able to hit it,” Nationals catcher Matt Wieters said. “As opposed to accidentally hitting it because it’s too close to the fastball.”

But the change-up couldn’t shield Ross from the tough luck dished his way. After Zimmerman saved two runs with a diving snag in the second inning, the Mets cleanly secured their first run on deGrom’s leadoff home run in the third, a blast to left-center field that temporarily upped the pitcher’s batting average to .300.

New York then was the recipient of a couple of breaks in the fourth inning as it took its first lead at home against the Nationals this season. It started when the sun prevented Daniel Murphy from catching a routine popup in shallow right field off Lucas Duda’s bat to lead off the frame.

“I was hoping one of our outfielders would have been kind of close enough to help Murph on that ball,” Baker said.

But no outfielder was in sight, and the ball dropped. Duda later scored on Travis d’Arnaud’s single to center field — but only because Wieters, who duped Duda into thinking a throw wasn’t coming, couldn’t hold on to the ball after applying a tag. Duda didn’t slide but kicked the ball out of Wieters’s glove after the home plate umpire initially called him out. Wieters was charged with an error, and the run gave the Mets their first home lead against the Nationals this season after 59 1/3  innings.

New York then scored its third run when Michael Conforto’s hard-hit groundball bounced off the glove of a diving Anthony Rendon. The ricochet allowed T.J. Rivera to score the Mets’ second unearned run of the inning.

“[Ross] threw the ball better than the numbers show,” Wieters said.

Ross’s command slipped in the sixth inning as he served up pitches over the plate, which the Mets converted into a fourth run. He concluded his performance with a difficult play fielding a swinging bunt by Jose Reyes on his 103rd pitch.

“The one inning was kind of tough,” said Ross, who allowed nine hits and struck out four. “I think the sun ball, the fact that it was the first hitter kind of sucks. But, overall, I felt pretty good. I felt like I executed pitches pretty well but just didn’t go my way today.”

Murphy doubled off Reed in the ninth inning to extend his streak of reaching base safely against his former employer to 29 games. But he ended the game at second base. The Nationals went down silently, but it was not a failed weekend. They are headed to Miami with their division lead back in the double digits, weary but eager for three more chances to widen that gap before their first day off in three weeks.

jorge.castillo@washpost.com