SCOTTSDALE, Ariz. — It was a trade the Cubs felt they absolutely had to make, but the player they parted with nonetheless made it hurt.

Although they were running away with the NL Central and were all but certain to have home-field advantage in the National League playoffs, before the Aug. 1 non-waiver trade deadline, the Cubs made no secret of their need for a consistent back-end-of-the-bullpen arm and settled on the Yankees’ Aroldis Chapman as their No. 1 target.

The cost for what might amount to a two-month rental — Chapman would become a free agent at season’s end — was steep.

In return, the Yankees wanted Gleyber Torres, a shortstop with rare power from Venezuela who was the top prospect in the Cubs’ organization. They had signed him at age 16 for $1.7 million in July 2013.

“He’s a terrific player,” Cubs general manager Jed Hoyer said in an interview last week at the annual general managers’ meetings. “It was a difficult decision for us.”

The Yankees also received righthander Adam Warren, who became a key reliever for them after the trades of Chapman and Andrew Miller, along with minor-league outfielders Rashad Crawford and Billy McKinney.

advertisement | advertise on newsday

The Cubs, of course, have no regrets.

Although Chapman very well could end up back with the Yankees, given the mutual interest in a reunion at the right price, he pitched to a 1.01 ERA in 28 games after the trade and gave the Cubs exactly what they needed as they won their first world championship since 1908.

“We felt like, the phrase we kind of used over and over was, ‘If not now, when?’ ” Hoyer said. “There was consensus in the room [before the deadline] that this is the spot we need to improve. And so you never want to give up a player like Torres, but at the same time, we felt this was a unique opportunity for us to win the World Series, and we know we don’t win the World Series without Chapman. But we also know that Gleyber’s going to be a really, really good player.”

From the Yankees’ perspective, the early returns — and it must be stressed just how early it is — have been exciting.

The 19-year-old has ripped apart Arizona Fall League pitching for the Scottsdale Scorpions and entered Friday leading the league in average (.392), on-base percentage (.516) and OPS (1.182) and ranking second in slugging percentage (.667).

Yankees videos

“Not your lean, classic angly body [for that position],” one opposing team scout covering the AFL said of the 6-1, 175-pound shortstop. “But very, very good hands and feet. Can really hit a fastball. I don’t know if he’s going to be a slam-dunk star but I think he’s going to be a really good everyday player. That’s a good get.”

Another opposing team scout in Arizona covering the league talked about Torres’ “live bat.” He also mentioned an approach that, entering Friday, had allowed him to strike out six times in 51 at-bats and draw 13 walks.

“There’s plate discipline, a plan up there, you don’t see from many players his age,” the scout said. “From a lot of players, period.”

Hoyer said the Cubs saw that maturity when they were scouting Torres in Caracas, Venezuela.

“Even when we signed him . . . his ability to go to right-centerfield and drive the ball the other way is really a precocious thing for a young hitter,” Hoyer said. “Most young hitters are pull-happy and then they eventually learn to use the whole field. Gleyber’s always used the whole field exceptionally well.”

advertisement | advertise on newsday

James Kaprielian, one of the Yankees’ top pitching prospects, is on the same AFL team as Torres.

“There’s no way he’s 19,” the 22-year-old Kaprielian, taken 16th overall by the Yankees in the 2015 draft out of UCLA, said with a smile last week. “He’s smart, he’s got savvy. There’s no way. It’s unbelievable, to be honest, for a 19-year-old to be playing the way he does. He goes up to the plate and he looks at the pitcher like he’s going to take him deep every time. He goes up with confidence.”

Yankees general manager Brian Cashman and some of his top baseball operations people — including assistant GM Michael Fishman, vice president of baseball operations Tim Naehring and special assignment scout Jim Hendry — took a break Tuesday afternoon from the GM meetings here to watch a Scorpions game. Torres went 3-for-4, including a double and a triple, with a walk and two RBIs.

“He’s doing everything that would make you smile at this point,” Cashman said.

Indeed, he was smiling.

advertisement | advertise on newsday

Hoyer, too, smiled at times while talking about Torres, though his expression projected something different.

Again, there are no Cubs regrets — and how could there be after ending professional sports’ longest drought without a title?

Still . . .

“This guy’s going to play in the big leagues and play at a high level for a long time,” Hoyer said. “At some level, that’s the cost of doing business.”