When Gleyber Torres punished the Twins’ pitching in a three-game sweep in the ALDS he was hitting sixth.

So, after the second baseman went 5-for-13 (.385) with a homer, four RBIs and went 2-for-3 with three RBIs with runners in scoring position, Aaron Boone elevated Torres to third in Game 1 of the ALCS against the Astros in Houston.

Torres responded by going 3-for-5 with a homer and five RBIs in a 7-0 Yankees win. Torres remained in the third spot for Game 2 and went 1-for-5.

In the Yankees’ 4-1 loss to the Astros in Game 3 on Tuesday at the Stadium, Torres was fifth against the Astros’ stud right-hander Gerrit Cole, behind the right-handed-hitting Edwin Encarnacion and one spot in front of the left-handed-hitting Didi Gregorius. Torres homered off Joe Smith in the eighth inning.

“We had a few more lefties, so spacing our lefties out,’’ Boone said of dropping Torres in the order. “Lineup-wise, we switch a lot based on who we have in there.’’

Torres’ homer pushed his postseason hitting streak to 10 games, and his three homers are tops by a Yankees player under 23 in a single postseason. Torres, who went 1-or-2 with two walks, is 22.

The switch-hitting Aaron Hicks was back in the lineup and hit ninth. Left-handed hitters Brett Gardner and Gregorius batted third and sixth, respectively, and went a combined 0-for-8. Gardner is 2-for-13 (.154) in three ALCS games and Gregorius is 1-for-12 (.083).