BOSTON -- The Boston Red Sox avoided their first four-game losing streak of the season -- barely.
J.D. Martinez scored when Marlins shortstop JT Riddle threw away a potential double-play ball in the ninth inning, lifting Boston over Miami 8-7 on Tuesday night following a wild, back-and-forth final two innings.
"It was pretty amazing that we were able to pull off a win tonight," said Jackie Bradley Jr., who had two hits and two RBI. "I don't believe in ugly wins. I believe in wins. As long as we continue to win, I don't care how ugly it is."
Miami scored five runs in the eighth inning to lead 6-4, allowed three runs to Boston in the bottom of the inning, then tied the game at 7 in the top of the ninth against closer Craig Kimbrel (4-1).
"We didn't pitch well of the last third of the game, but we swung the bats well and we ended up winning," manager Alex Cora said. "We took advantage of their mistakes."
Martinez started the final rally on a one-out single and went to second on Xander Bogaerts' hit.
"It's a two hopper -- step on the bag and throw the ball to first. As simple as that," Riddle said. "I throw the ball 80 feet and lose the game."
Drew Steckenrider (4-3) was stuck with the loss.
Nunez homered in the sixth to put Boston ahead 4-1, a lead that held until Matt Barnes' melted down in the eighth. Realmuto and Starlin Castro hit back-to-back home runs during the five-run inning, which also included a two-run single by Rafael Ortega.
"Obviously the ending was not very good, but it was kind of the way we played all night," Marlins manager Don Mattingly said.
Before batting around in the eighth, Miami's only score came on Isaac Galloway's solo homer in the third.
With two starters out of the rotation because of injuries, Boston's bullpen has been pushed lately and the wear has shown during the recent slide. After Barnes' implosion in the eighth, Kimbrel struggled in the ninth with two walks before allowing Magneuris Sierra's tying single.
"If we're going to be a successful team we're going to have to turn it around and we know that," Kimbrel said. "This is the team that we have and this is the team that we're going to make a run with, so we've got to figure it out or we're not going to win. I've got a pretty good feeling we're going to figure it out."
WELCOME BACK JOSE
Jose Urena returned to Miami after a six-game suspension and allowed four runs and six hits and struck out two in six innings. Urena, suspended for hitting Atlanta's Ronald Acuna Jr. with a pitch on Aug. 15, didn't figure in the decision.
Marlins: OF Garrett Cooper will have surgery Friday in Miami to repair a tendon sheath in his right wrist, Mattingly said.
Red Sox: LHP Eduardo Rodriguez (right ankle sprain) will return from the DL and start Saturday when the Red Sox visit the Chicago White Sox. Cora said Rodriguez's return will take some pressure off the starting rotation as well as the bullpen. ... LHP Chris Sale (left shoulder inflammation) played catch Monday, which Cora described as a "good start" but didn't offer a timetable for his return.
More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP-Sports
Pujols: 'My goal is to be ready for March 29th'
Albert Pujols says he knows exactly what he needs to do to be healthy and help the Angels win a championship.
Robinson Cano says he feels 25, not 36, as he reports to Mets
New York Mets infielder Robinson Cano had a youthful perspective after reporting to spring training with the New York Mets.
Madison Bumgarner says he was joking over opener refusal
Madison Bumgarner was joking when he told manager Bruce Bochy he absolutely refuses to pitch behind an opener.
Ryan Zimmerman not surprised Bryce Harper, Manny Machado unsigned
Ryan Zimmerman finds it odd that so many teams now feel the need to announce they are trying to win.
Reliever Aaron Loup agrees to 1-year, $1.4M deal with Padres
Left-hander Aaron Loup and the San Diego Padres have agreed to a one-year contract that guarantees $1.4 million, a deal that includes a team option for 2020.
Marcus Stroman wants new deal from Blue Jays, says, 'I've been offered nothing'
Marcus Stroman expressed frustration with the direction of the Blue Jays, saying he wants a long-term deal with the team but that front-office officials aren't returning the interest.