BOSTON (AP) — After trailing early by five runs, the Boston Red Sox slugged their way to a comeback victory.

Xander Bogaerts hit a solo homer in the seventh inning, Boston's fifth long ball of the game, and the Red Sox rallied to beat the Texas Rangers 7-6 on Thursday night.

"We found a way to win today instead of finding a way to lose," manager Alex Cora said.

Five players homered for Boston, which outlasted Texas to earn a split of the four-game series. The finale took 4 hours, 6 minutes.

All seven runs for Boston came on homers. Jackie Bradley Jr. hit a three-run shot in the second and the Red Sox also got solo homers from J.D. Martinez, Michael Chavis and Rafael Devers.

Bogaerts was the last to go deep for Boston, driving a pitch from Peter Fairbanks (0-1) out to left and completing a wild comeback for the Red Sox, who lost the first two games of the series.

Brandon Workman (4-1) got the win with a scoreless seventh despite walking two as Red Sox pitchers struggled with their command throughout the long night.

Josh Smith, the eighth pitcher for Boston, hit the first batter he faced in the ninth but managed to keep the Rangers off the board and picked up his first save.

Elvis Andrus drove in three runs on three singles for the Rangers. Logan Forsythe hit a two-run double and Hunter Pence had an RBI double for Texas, which stranded 14 runners.

It was the second straight night the Rangers lost by a single run.

"We had a chance, honestly, to win all four games. We had a chance to sweep them," manager Chris Woodward said. "You've got a 6-1 lead against this team, you've got to beat them."

Texas tagged lefty David Price for five hits and six quick runs. Price threw 49 pitches in just 1 1/3 innings before he was pulled.

"Obviously, we wanted David to go deep and pitch well but we never felt that we were out of the game," Cora said. "Honestly, today it was a different vibe in the dugout. It was good."

The Red Sox were able to slug their way back into it against Adrian Sampson, who won his previous five starts. Chavis homered in the fourth and Devers went deep in the fifth to tie it.

Martinez also hit a solo shot in the first off Sampson, who allowed four homers in five innings. He gave up six runs and seven hits.

Price struggled from the start, needing 38 pitches to get out of the first with the Rangers leading 4-0. He hit Shin-Soo Choo with a pitch and walked Delino DeShields before Elvis Andrus followed with an RBI single. Pence doubled off the top of the wall in right for a 2-0 lead, and Forsythe hit a two-run double.

Price struck out Jeff Mathis to start the second, but didn't get another out. He plunked Choo again, DeShields doubled and Andrus drove in both with a single.

The Rangers didn't score again.

"That's baseball," Pence said. "You've got to play all nine and you've got to keep finding ways to get runs in. It just didn't happen tonight."

MUCH APPRECIATED

Price cheered on his teammates from the dugout as the Red Sox chipped away at the lead.

"The bullpen came in and did an unbelievable job," Price said. "Our offense bailed me out and helped us win that game. That's the type of game we can rally around and keep going."

More From 92.9 The Ticket