Toronto Blue Jays second baseman Yangervis Solarte mishandles a pop fly by Boston Red Sox’s Blake Swihart for an error in the eighth inning at Fenway Park on Thursday, Sept. 13, 2018, in Boston. Boston’s Xander Bogaerts scored the go-ahead run from third on the play. (AP Photo/Elise Amendola)

BOSTON — J.D. Martinez hit his 41st home run and the Boston Red Sox moved closer to clinching the AL East title, completing a three-game sweep of the Toronto Blue Jays with a 4-3 victory Thursday night.

Xander Bogaerts scored the go-ahead run on an eighth-inning error after the Blue Jays rallied in the top half with two runs to tie it 3-all.

Rafael Devers also homered for the major league-leading Red Sox (101-46), who pulled 10½ games ahead of the idle New York Yankees and decreased their magic number to six for clinching a third straight division crown.

Boston is the only team in the majors that’s already locked up a playoff berth.

Brandon Workman (5-0) faced one batter, ending Toronto’s eighth-inning rally, and got the win. Craig Kimbrel earned his 40th save.

Danny Barnes (3-3) took the loss.

Lourdes Gurriel Jr. homered for the Blue Jays.

Gurriel’s drive pulled Toronto to 3-2 in the eighth and the Blue Jays added another run after Justin Smoak walked with two outs and Kendrys Morales followed with a single. Joe Kelly hit Randal Grichuk with a pitch to load the bases, then plunked Kevin Pillar to force in the tying run.

Bogaerts stole third after hitting a one-out double in the eighth and scored when second baseman Yangveris Solarte dropped a popup in shallow right field.

Devers hit a solo homer to right with two outs in the sixth off Mark Leiter Jr., putting Boston up 3-1.

Martinez went deep in the second, tying Oakland’s Khris Davis for the major league lead in homers.

Smoak singled home Gurriel in the third, and Ian Kinsler had a sacrifice fly for Boston in the bottom half.

Sam Gaviglio pitched 3 1/3 innings for Toronto, allowing two earned runs and six hits with one walk and one strikeout.

Eduardo Rodriguez struck out seven over six innings for the Red Sox. Rodriguez retired the last nine batters he faced, striking out two in the sixth before Boston turned it over to the bullpen in the seventh. He allowed one run on five hits and didn’t walk a batter.

TRAINER’S ROOM

Red Sox: 3B Eduardo Nunez left in the fourth with soreness in his right knee after hitting a leadoff double. Nunez, who tripped and stumbled over first base while running out a fielder’s choice in the second, was replaced by Devers.

UP NEXT

Blue Jays: RHP Marco Estrada (7-11, 5.32 ERA) starts for Toronto in the first of three games against the Yankees in New York.

Red Sox: RHP Hector Velazquez (7-2, 3.29) starts as the Red Sox open a three-game series at home against the New York Mets.