Max Kepler's single with one out in the 17th inning gave the Minnesota Twins 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.

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

Minnesota Twins' Eddie Rosario swings for a strike against the Boston Red Sox during the first inning of a baseball game Tuesday, June 18, 2019, in Minneapolis. (AP PhotoStacy Bengs)

Minnesota Twins' Eddie Rosario swings for a strike against the Boston Red Sox during the first inning of a baseball game Tuesday, June 18, 2019, in Minneapolis. (AP PhotoStacy Bengs)

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.

Boston had a six-game winning streak snapped.

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 of the game. Rafael Devers then grounded out to first, and Xander Bogaerts grounded to third.

Boston Red Sox's Rafael Devers gets tagged by Minnesota Twins' Jonathan Schoop for an out after trying to steal to second base during the fourth inning of a baseball game Tuesday, June 18, 2019, in Minneapolis. Schoop caught the ball from catcher Mitch Garver. (AP PhotoStacy Bengs)

Boston Red Sox's Rafael Devers gets tagged by Minnesota Twins' Jonathan Schoop for an out after trying to steal to second base during the fourth inning of a baseball game Tuesday, June 18, 2019, in Minneapolis. Schoop caught the ball from catcher Mitch Garver. (AP PhotoStacy Bengs)

Both 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.

TRAINER'S ROOM

Boston Red Sox's Andrew Benintendi slides safely back to first base against as Minnesota Twins' C.J. Cron catches the ball from Michael Pineda during the first inning of a baseball game Tuesday, June 18, 2019, in Minneapolis. (AP PhotoStacy Bengs)

Boston Red Sox's Andrew Benintendi slides safely back to first base against as Minnesota Twins' C.J. Cron catches the ball from Michael Pineda during the first inning of a baseball game Tuesday, June 18, 2019, in Minneapolis. (AP PhotoStacy Bengs)

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 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 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.