DETROIT — Brad Ausmus was thankful things worked out. The Detroit Tigers’ manager didn’t relish the thought of playing extra innings with his top two run producers out of the game.

Ausmus pinch-ran for Miguel Cabrera and Victor Martinez in the bottom of the eighth inning Thursday and was rewarded, after some tense moments, when Andrew Romine walked with the bases loaded and two out to force home the winning run in Detroit’s 4-3 victory over the Boston Red Sox.

It was the Tigers’ first victory following three straight losses and the first time the Red Sox had tasted defeat in seven games.

“It was fun,” Ausmus said. “It hasn’t been fun around here the last few days.”

Detroit had scored just one run in each of three straight defeats by Kansas City and looked on its way to possibly a fourth when the game entered the eighth tied at 1-1.

Boston scored twice in the top of the inning only to see Detroit answer with three.

Ian Kinsler singled leading off the bottom of the eighth against Red Sox reliever Junichi Tazawa (2-2), Erick Aybar doubled and Cabrera lined a single to center to shave the deficit to 3-2. It was Cabrera’s 1,000th RBI as a Tiger.

“Geno and I talked about it before the inning even began,” Ausmus said. “If Miggy got on we were going to have to run for him. But I wanted to wait until he got into scoring position because if you run for him at first and the next guy hits into a double play, he’s out of the game.”

Victor Martinez greeted reliever Brad Ziegler with a ground RBI single to right, tying the score at 3, which prompted Ausmus to pull Cabrera off second base in favor of Tyler Collins, who had a bad right knee from being hit by a pitch Wednesday.

J.D. Martinez walked to load the bases with nobody out and Ziegler got a force-out at home, after which Ausmus pulled Victor Martinez off third in favor of pinch-runner Justin Upton.

“Before the game he (Collins) came to me and said he was able to pinch-hit but not run, but he also said by the middle of the game he might be able to run,” Ausmus said. “I asked him in the eighth inning if he could run and he said, ‘Yes, do you want me to run out there?’

“I hated the thought of having to go into extra innings with our best two hitters out of the game.”

Ziegler got a groundout and a strikeout but walked Romine on a 3-1 pitch, which was inside. Romine had faked a squeeze but pulled back on the 2-1 pitch, which was also inside.

“They strung some hits together,” Boston manager John Farrell said. “We went with Tazawa just because of the history against those top three guys. With Ziegler (against low-ball hitters), it didn’t work out.

“Again, particularly with the way Cabrera swung the bat, we were looking to get some pitches that (Tazawa) could elevate at times to spread the strike zone. A first-pitch breaking ball for a base hit ends up scoring one, and then after three consecutive base hits, unfortunately I’ve got to get him, and it’s not the greatest matchup for Brad against Victor. But still, in the end, the eighth inning was obviously the pivotal moment in this.”

Consecutive singles by Xander Bogaerts, Mookie Betts and Hanley Ramirez off Alex Wilson leading off the top of the eighth broke a 1-1 tie and Justin Wilson (3-4) wild-pitched Betts home following a reverse-force double play to give Boston a 3-1 edge.

Francisco Rodriguez earned his 34th save for pitching a scoreless ninth, although he walked the leadoff batter and gave up a one-out pinch single to David Ortiz. Bogaerts grounded out before Betts lined out to second to end the game.

Boston starter Clay Buchholz allowed six hits in his six innings, striking out three with no walks.

Detroit’s Matt Boyd scattered five hits over his six innings, walking two and fanning four.

Sandy Leon, serving as the designated hitter with Ortiz not in the starting lineup, hit his seventh home run of the season to lead off the fourth inning against Boyd and tie the score at 1.

A bizarre play in the second led to Detroit’s first run.

J.D. Martinez singled sharply to left off Buchholz with one out and Casey McGehee hit a full-count short liner to right-center that Jackie Bradley Jr. seemed to catch before dropping it as he dove and slid on the turf.

An out signal was given by first base umpire Jerry Layne and Martinez retouched second and safely got back to first before the confusion began. The Tigers challenged the out call and it was reversed upon review, with Martinez awarded third base and McGehee planted back on first.

Jarrod Saltalamacchia hit a sacrifice fly to center after Red Sox third base coach Brian Butterfield was ejected with a 2-0 count for excessive dugout chirping. It was the sixth time in his career that Butterfield has been thrown out of a game.