Yankees catcher Austin Wells runs on his two-run double against...

Yankees catcher Austin Wells runs on his two-run double against the Texas Rangers during the third inning in Game 1 of an MLB doubleheader at Yankee Stadium on Saturday. Credit: Kathleen Malone-Van Dyke

Figuring out a cleanup hitter this season had taken on the complexity of a Rubik’s Cube for manager Aaron Boone deep into July.

Slotting Juan Soto at No. 2, foolproof. Same for Aaron Judge third. Those pieces slid into place easily enough.

But the Yankees had started six different names in that No. 4 spot before Boone — in a moment born of both inspiration and desperation — chose to insert Austin Wells there on July 20. By then he was out of choices, thanks to injury or ineptitude.

How could Wells be any worse? The Yankees deployed baseball’s most lethal one-two artillery punch, then too often followed it up with a Nerf Blaster.

Alex Verdugo was at the head of the class, hitting .222 with a .623 OPS in 49 games of cleanup duty. Next was Anthony Rizzo (remember him?) at .206 and .571 over 16 games there. Then Giancarlo Stanton, who looked more like a lower-case g, batting .195 with a .537 OPS in 29 games behind Judge.

Not exactly a modern-day Murderers’ Row. As cleanup crews go, this was more mop-worthy than monstrous, and the Yankees consistently ranked in MLB’s basement when it came to production from that particular locale.

As for the desperate part, J.D. Davis’ pinstripe cameo involved four starts, resulting in a grand total of one RBI double, five strikeouts and a subsequent DFA.

All that futility, however, eventually got them to Wells, who has been a revelation in rounding out the top half of Boone’s lineup. That continued Saturday afternoon, when Wells went 2-for-5 with four RBIs (also catching the shutout) in the Yankees’ 8-0 rout of the Rangers in Game 1 of the doubleheader.

This was no isolated assault by Wells, either. Starting in the cleanup spot, he is batting .362 (21-for-58) with three doubles, a triple, two homers, seven walks and 13 RBIs in 15 games (14 starts).

Moving him to No. 4 is among the Yankees’ best decisions this season, if not No. 1, even if Boone sort of backed into it. Despite an uneven first half, there still was a belief in Wells’ hitting.

“He’s hitting there because I think that,” Boone said. “But it’s been really good to see, because the hitting side, which we all expected was going to be his calling card and carry him, took a minute at this level to get going.”

Boone was referencing the fact that Wells was batting .196 at the start of June and .213 a month later, nowhere near the damage he had inflicted at every level during his development. But Wells finally has found that groove again in the majors, and in his last 33 starts, dating to June 6, he’s hitting .308 with seven homers, 26 RBIs and a .928 OPS.

On Saturday, after stranding Soto and Judge in the first inning with a line drive that was run down in deep left-center, Wells made the most of his second chance in the third, hammering Nathan Eovaldi’s signature splitter for a two-run double to right-center that put the Yankees ahead 3-0. After Judge’s double in the fourth, Wells struck again, battling hard-throwing lefty reliever Brock Burke and smacking a two-run single up the middle.

Wells shrugged off any suggestion that the cleanup gig comes with additional pressure, but there are definite advantages. Studying how Soto and Judge work the guy on the mound supplies him with plenty of useful intel for his own turn.

“It’s great,” Wells said. “They see a lot of pitches, so I get to see them as well .  .  . I think for me, there was a little bit of adjustment of not trying to hit the ball 500 feet like they do. But just staying within myself, trying to get a good pitch to hit and then let it take care of itself.”

That approach has been effective for all parties involved. Soto and Judge usually are on base anyway, but if teams pitch around the Yankees’ captain — as they’ve increasingly done in the second half — Wells is better equipped to make them pay for those free passes.

In June, or even early July, Boone didn’t think Wells was quite ready for the assignment. But in what now appears to be a case of fortuitous timing, the Yankees ran out of cleanup-hitter options at the same point that Wells looked capable of being a productive weapon there. He provides the righty-lefty balance Boone prefers behind Judge and has matured into the role.

“It just kind of came together,” Boone said. “Because we were struggling a little bit in that spot, we had a couple guys go through a downturn, and he was the one guy giving us those real consistent at-bats.”

And it’s not just a cleanup thing. Wells ranks fourth among all MLB catchers with a 2.7 WAR (according to FanGraphs, minimum 250 plate appearances), showing that he’s quickly becoming the sort of franchise backstop the Yankees had envisioned. Wells not only provided half of Saturday’s offensive output but helped rein in Carlos Rodon for five innings.

“He maneuvered the erratic-ness from me today,” Rodon said before adding, “I think defensively he’s been outstanding since he’s been here, and now you’re seeing what the Yankees had seen in him with the bat. We all knew it was in there.”

And now Wells is in the right spot, too. At the right time.

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 5 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME