Yankees second baseman Gleyber Torres reacts after hitting a three-run home...

Yankees second baseman Gleyber Torres reacts after hitting a three-run home run in the fifth inning against the Rays at Yankee Stadium on Thursday. Credit: Jim McIsaac

Gleyber Torres cracked the 12th homer of his remarkable rookie season Wednesday night, but was overshadowed by the two homers blasted by Nationals rookie Juan Soto in the Yankees’ loss.

Torres took back center stage Thursday night. With his teammates mostly struggling against Rays lefthander Blake Snell, the 21-year-old ripped a game-turning, three-run homer in the fifth inning that helped the Yankees to a 4-3 victory at the Stadium.

“Another huge hit by GT,” Aaron Boone said of Torres, who leads all big-league rookies with 13 homers and 33 RBIs.

It was more surprising power from Torres, whose professional high in homers was 11 in the minors in 2016.

“It’s weird,” a smiling Torres said of the power surge. “I don’t think about homers, I just try to put the ball in play and help the team, do my job every time. If I get a homer, I’m happy. Just try to take good at-bats.”

The Yankees (44-20) received a solid six innings from rookie Domingo German, who struck out a career-high 10, giving him 19 strikeouts in his last 12 innings. The Yankees won for the 13th time in 17 games.

German allowed three runs and five hits in earning his first career victory. He left with a 4-3 lead, and the bullpen continued to be a lockdown unit.

Chad Green pitched a scoreless seventh, when Gary Sanchez threw out Carlos Gomez trying to steal third. Dellin Betances struck out two in a scoreless eighth, and Aroldis Chapman struck out two in a perfect ninth for his 19th save.

The Rays (32-36) took a 2-0 lead into the fifth against the Yankees, who had stranded five runners. But Aaron Hicks hit a one-out homer and Aaron Judge, who struck out his first two times up, lined a single. After Giancarlo Stanton struck out, the slumping Sanchez, back in the lineup after a two-day break, walked to set up Torres.

The second baseman, batting fifth this night, worked the count full before turning on a 96-mph fastball and hammering it to deep left-center for a 4-2 lead. It was his ninth homer in his last 21 games and his first hitting anywhere other than ninth, where he hit in 35 of his first 44 games.

“The first two at-bats, he pitched me pretty well,” said Torres, who had struck out and flied out. “In the third at-bat, I just relaxed and focused on having a good at-bat. If not me, guys behind me are pretty good.”

Matt Duffy ambushed German to start the night, swinging at a first-pitch fastball and sending it over the wall in left, giving the Rays a lead before most of the fans had a chance to settle in their seats.

German allowed two first-inning homers Saturday to the Mets before settling in to strike out nine in six innings. He rebounded Thursday to strike out the next three hitters — Jake Bauers, Wilson Ramos and C.J. Cron — swinging at curveballs.

The righthander allowed one more run, in the sixth, after Torres had given him the led.

Boone was asked what stands out the most about Torres in important at-bats.

“His ability to adjust,” Boone said. “He’s hit a lot of different pitches out for home runs, whether it’s offspeed pitches, fastballs. In different quadrants of the strike zone he’s shown an ability to handle different pitches. His in-game adjustability, both him and Miggy [Miguel Andujar], their ability to adjust to what a pitcher’s doing is something I’ve been really pleased with.”

More Yankees headlines