DETROIT (AP) — Eduardo Rodriguez struck out 10 in five shutout innings and the Boston Red Sox snapped a five-game losing streak with a 4-1 win over the Detroit Tigers.

Rodriguez allowed two hits and four walks in helping Boston end its longest losing streak of the season. J.D. Martinez, Enrique Hernandez and Jarren Duran homered for the Red Sox.

Boston pitchers struck out 18 batters, with Matt Barnes getting two as he pitched a perfect ninth for his 24th save in 28 chances.

Detroit’s Casey Mize gave up four runs on seven hits and a walk in five innings. He struck out three and allowed all three Boston homers.