Aaron Judge of the Yankees celebrates his ninth-inning walk-off home run...

Aaron Judge of the Yankees celebrates his ninth-inning walk-off home run against the Royals at Yankee Stadium on Thursday. Credit: Jim McIsaac

Aaron Judge pulled up hard on the stick Thursday night to get the Yankees out of what had become a steepening nosedive.

There was downward momentum to fight after losing five of the previous seven games and 10 of the previous 15, not to mention producing only one hit in the first eight innings against Kansas City. But Judge — of course Judge — muscled the Yankees out of it by driving a first-pitch fastball from  Scott Barlow into the centerfield side of the Royals' bullpen for a walk-off home run with one out in the ninth for a 1-0 victory before 43,836 at the Stadium.

After he crossed the plate and was mobbed by teammates following his 39th home run, chants of “MVP! MVP!” from the crowd washed over him.

“You go up there and try to do a job and get something over the plate to make something happen for the guys behind me,” Judge said after picking up the Yankees' second hit of the night. "Luckily it happened on the first pitch and we were able to get it done. I just try not to think too much in those situations.”

The home run came off the bat at 110 mph and went 431 feet. He is the first Yankee since Mickey Mantle in 1959 to hit three walk-off home runs in a single season.

“We've had the best player in the game on our side and it seems like time and time again when it matters most, he seems to come up big,” manager Aaron Boone said. “He’s in the middle of a special MVP-like season.”

While almost all in attendance could see the ball going out off the bat — including Barlow — both Judge and Boone thought he might have gotten too far under it. Judge said, “I was sitting off-speed and got a heater, but thought I hit it too high.” Boone said of the drive: “I was talking to it, telling it to kick, [but] I knew it had a chance just because it’s him.”

Judge's production of 39 homers in 100 games (he has played in 97)  projects to 63, which would set an American League record. After a slow start, he has 38 homers and 81 RBIs in his last 84 games, including six homers in his last seven games and nine in his last 12. The homer off Barlow gave him four walk-off hits for the season and five for his career.

“The guy is insane,” starter Jameson Taillon said. “I love his swing. I think he's got the sweetest righthanded swing in the game and . . . insane power. That, mixed with his experience playing in the big moments [and] facing the best of the best? It's just an overall recipe for it.”

Closer Clay Holmes (5-1) navigated a pair of walks in the ninth to end up with the win after Taillon threw six scoreless innings and reliever Ron Marinaccio put up two more zeros. Marinaccio has not allowed a run in 19 innings in his last 15 appearances. Opposing batters are 1-for-57 against him in that span.

It was Taillon’s best performance in nearly two months, since eight scoreless innings against Tampa Bay on May 27. In his previous nine starts, the righthander had a 6.98 ERA in 44 1/3 innings pitched. Opponents had a .310/.349/.560 slash line with 10 home runs.

“[I was] working both sides a lot better,” Taillon said. “I thought the fastball had a better profile than [before]. I felt the misses were a lot more competitive tonight . . . misses to good areas.”

Taillon became tough when Kansas City threatened — the Royals were  0-for-7 with runners in scoring position against him — and put out fires in the second and third innings. After Nick Pratto’s one-out triple in the second, Taillon got Maikel Garcia to fly out to shallow center and struck out Kyle Isbel. MJ Melendez had a leadoff double in the third, but Taillon whiffed Whit Merrifield and got groundouts by Vinnie Pasquantino and Hunter Dozier.

Leftfielder Andrew Benintendi, acquired from these same Royals on Wednesday night in exchange for three pitching prospects, went 0-for-4  but enjoyed a warm and vocal embrace from the home crowd when he led off in the first inning.

More Yankees headlines

Newsday LogoCovering LI news as it happensDigital AccessOnly 25¢for 5 months