<p>New York Yankees’ Aaron Judge waits on deck during the first inning against the Minnesota Twins on Wednesday. Judge left the game in the sixth inning for a pinch hitter because of tightness in his lower right leg.</p>
                                 <p>Abbie Parr | AP Photo</p>

New York Yankees’ Aaron Judge waits on deck during the first inning against the Minnesota Twins on Wednesday. Judge left the game in the sixth inning for a pinch hitter because of tightness in his lower right leg.

Abbie Parr | AP Photo

<p>New York Yankees relief pitcher Clarke Schmidt follows through on a pitch during the seventh inning against the Minnesota Twins on Wednesday.</p>
                                 <p>Abbie Parr | AP Photo</p>

New York Yankees relief pitcher Clarke Schmidt follows through on a pitch during the seventh inning against the Minnesota Twins on Wednesday.

Abbie Parr | AP Photo

MINNEAPOLIS — Luke Keaschall went 3 for 5 and scored from second base on Victor Caratini’s game-ending single in the 13th inning Wednesday, sending the Minnesota Twins past the New York Yankees 5-4.

New York Yankees star right fielder Aaron Judge was pulled for a pinch hitter in the sixth inning because of tightness in his lower right leg, a precautionary move after an injury he characterized as a normal occurrence soon after a long layoff.

Judge, who was on the bench Tuesday for planned rest, struck out in both of his at-bats against Minnesota starter Zebby Matthews before being replaced by Heliot Ramos. Judge had to run to the gap to track down a double in the fifth inning, his last action in the field, but he didn’t show any sign of slowness on that play. He said he felt the discomfort while playing in the field in the first inning.

The three-time AL MVP is 4 for 26 with 13 strikeouts and one extra-base hit in seven games since returning last week from a broken rib.

“We’re still trying to ramp up so there’s still going to be little things like this that come up,” Judge said after the loss. “I just thought it would be best instead of pushing through it like I normally do.”

After Yankees relievers got the Twins to ground into inning-ending double plays in the 9th, 10th and 12th innings, John Schreiber (2-4) took the hard-luck loss. Leading off the 13th with Keaschall on second, pinch-hitter Caratini smacked an 0-1 sinker straight up the middle that rookie shortstop George Lombard Jr. charged but had scoot underneath his glove.

The Yankees (88-64) entered the game with a 3 1/2-game deficit behind AL East leader Tampa Bay.

Tommy Nance (3-3) pitched a perfect 13th for the Twins (71-81), who avoided a three-game sweep and tied the six-game season series with their longtime nemesis. The Yankees are 130-49 against the Twins over the last 25 seasons, including 16-2 in the postseason.

Yankees batters struck out a season-high-tying 17 times, including five by Spencer Jones, and had a season-most 13 men left on base.

Anthony Volpe’s tying two-run double with two outs in the ninth off Yoendrys Gómez put the Yankees on the board after they were silenced by Twins starter Zebby Matthews over six innings.

Keaschall drove in the automatic runner with a leadoff single in the 10th to tie the game after Ali Sanchez’s RBI single in the top of the inning. José Caballero and Royce Lewis traded sacrifice flies in the 11th.

Yankees starter Carlos Rodón gave up two runs in six innings, including Ryan Kreidler’s home run in the fifth. He was relieved by Clarke Schmidt, who made his first appearance in 14 months after elbow surgery.

The Yankees are off Thursday before RHP Gerrit Cole starts the series opener Friday at Arizona.

Local journalism matters, and your support makes it possible. You can help sustain this work by making a donation or choosing one of our subscription options. Subscribers enjoy valuable benefits, including full access to our e-edition, a reduced ad experience on timesleader.com, and more.

Your support helps ensure independent, high-quality local news remains available today and for future generations. Thank you for standing with local journalism.

Click for subscription offers.