Giancarlo Stanton of the Yankees is mobbed by his teammates...

Giancarlo Stanton of the Yankees is mobbed by his teammates after his ninth-inning walk-off base hit against the Nationals at Yankee Stadium on Sunday. Credit: Jim McIsaac

Giancarlo Stanton, the hottest hitter in baseball a few days ago, hadn’t had a hit since Thursday when he came to the plate with the winning run 90 feet away and one out in the bottom of the ninth inning of a tie game on Sunday at Yankee Stadium.

Facing lefthander Brad Hand, Stanton lined a 2-and-2 pitch into leftfield for a game-ending single as the Yankees beat the Nationals, 3-2, for their second walk-off win in two days.

Stanton had been 0-for-10 in the series — his 12-game hitting streak ended on Friday — and had grounded into an inning-ending double play with a chance to put the Yankees ahead in the seventh.

"I love those moments," Stanton said after his seventh career walk-off hit and second as a Yankee. "I had one earlier in the game that I didn't capitalize on. It’s not too often you get two opportunities in the same game, but definitely better get the second one if you don't get the first."

Said manager Aaron Boone: "I don't know that I noticed anything real different from the stretch where he had the long hitting streak. Maybe expanded a little bit more. But then again, I thought like today, for example, I thought they'd pitch really carefully to him."

Nationals manager Dave Martinez — who in the eighth inning intentionally walked .103-hitting Mike Ford to get to .145-hitting Clint Frazier in a move that worked when Frazier popped out to strand two — could have ordered Stanton walked to get to Aaron Hicks with the bases loaded. But he didn’t, and the Yankees are glad about that.

The victory completed a 7-2 homestand for the Yankees (18-16), who beat the Nationals on Saturday, 4-3, in 11 innings. They have won 12 of their last 17 games.

"It’s been tough here, but these guys keep grinding away and find a way to win ballgames," Boone said. "It's not always going to be easy. It's not always just have your way with a team, but you're going to have to win these tough ones every now and then to be a little bit of a separator as a club. Good to see us get the back-to-back wins where it wasn't perfect."

The ninth inning started with Hand (2-1) walking Tyler Wade on four pitches. Aaron Judge, who was given a day out of the lineup, then walked as a pinch hitter, giving the Yankees 10 walks in the game.

DJ LeMahieu grounded into a forceout at second, with Wade taking third. After falling behind 1-and-2, Stanton got even and then sent the Yankees into an infield celebration to lead into an off-day before their longest road trip of the season begins on Tuesday at Tampa Bay.

"These are great games to feed off of," Stanton said. "Battles back and forth and, after a long day [Saturday], for today to come down to the wire as well. Just any way you can — any way you can squeeze out a win and build that momentum down into Tampa."

The Yankees took a 1-0 lead in the third on Hicks’ run-scoring single to center off Joe Ross. Domingo German was putting up zeros, and Gleyber Torres made it 2-0 leading off the sixth with his first home run of the season.

Torres, who had gone 135 plate appearances without going deep this season, crushed a 2-and-0 pitch 411 feet into the leftfield bleachers. He pumped his right fist before dropping his pink Mother's Day bat.

"One for my mom," said Torres, who said he remembers hitting three Mother’s Day home runs in the minors.

The Nationals tied the score at 2 in the seventh. Josh Bell led off with a double and, one out later, Kyle Schwarber hit a two-run homer into the second deck in right on German’s 80th and final pitch.

German went 6 1/3 innings and allowed five hits with one walk and six strikeouts. Aroldis Chapman (2-0), the fourth Yankees pitcher, got the win.

"Good way to end a successful homestand," Boone said. "It was a bit of a grind again today, but Domingo was terrific, obviously, and good to see us come up with some key at-bats there in the end."

More Yankees headlines

Newsday LogoSUBSCRIBEUnlimited Digital AccessOnly 25¢for 5 months