MINNEAPOLIS (AP) — Max Kepler was supposed to have the night off. Instead, the Twins outfielder wound up playing 12 innings and delivered three huge hits.

Kepler's single with one out in the 17th gave Minnesota a 4-3 victory over the Boston Red Sox early Wednesday in the longest game by innings in Target Field history.

Kepler hit a tying homer in the 13th before his hit down the first-base line past a five-man Red Sox infield scored Luis Arraez to end a game that took 5 hours, 45 minutes — tied for the fourth-longest in Twins history.

"Everybody just wanted to put an end to the game," said Kepler, who pinch hit for Marwin Gonzalez in the sixth inning. "It was a wild game. I'm glad it went our way in the end."

The winning hit came off Brian Johnson (1-1), who pitched the 17th inning for the Red Sox. Johnson threw three innings as Boston's starting pitcher Sunday.

"That's a way better story and way more fun if we win and the outcome of that game," Johnson said. "It wasn't the result, so it's tough to swallow."

The game ended at 12:55 a.m. local time on the first walk-off win of the season for the Twins, who have yet to lose three straight games all season.

"That was one of the best games I've been a part of, ever, in baseball," said Twins manager Rocco Baldelli. "I think a lot of people in that clubhouse can say the same thing."

Boston had a six-game winning streak snapped.

The Red Sox used eight relievers in relief of lefty David Price, who went just five innings. The Twins also used eight arms out of the bullpen to back up Michael Pineda's strong start. Pineda allowed one run in six innings.

Boston had a runner on third and nobody out in the 17th but couldn't score against Zack Littell (1-0), who earned his first career win. With Andrew Benintendi standing on third base, J.D. Martinez struck out for the fifth time. Rafael Devers then grounded out to first, and Xander Bogaerts grounded to third.

"There was a lot of stuff weird in this game, but we played to the end," said Boston manager Alex Cora. "They scored one more run than us."

The teams traded solo homers in the 13th inning. Mookie Betts put Boston up 3-2 before Kepler launched his 18th homer to keep the game going.

Kepler also had a big hit in the eighth as his two-out single to left tied the game at 2.

The Twins (48-24) maintained a tie for the best record in baseball.

"That would be so hard to go that far and use all the pitchers that you did, grind out at-bats and then lose," said Mitch Garver, who caught all 17 innings for the Twins. "I've been on the losing side of those before."

TRAINER'S ROOM

Red Sox: OF Steve Pearce (lower back strain) and RHP Tyler Thornburg (right hip impingement) were both scheduled to play in a rehab assignment Tuesday with Triple-A Pawtucket, but the game was rained out.

Twins: Minnesota placed CF Byron Buxton on the 10-day injured list, retroactive to June 15th, with a right wrist contusion. The Twins recalled outfielder Jake Cave from Triple-A Rochester to take Buxton's spot on the roster. Cave started in center field Tuesday. ... Infielder Ehire Adrianza was also played on the 10-day IL on Tuesday with abdominal issues, and rookie Arraez was called up from Rochester as a corresponding roster move.

UP NEXT

Red Sox: LHP Eduardo Rodriguez (7-4) matched his longest start of the season in his most recent outing, going seven innings in a win at Baltimore. He's won three of his last four starts.

Twins: RHP Kyle Gibson (7-3) is looking to build off his best start of the season. Minnesota's veteran righty threw eight shutout innings and allowed just two hits in a win against Kansas City his last time out.

More From KROC-AM