WATCH: Boston Red Sox rally in 9th to defeat Blue Jays

MLB power rankings
May 20, 2021; Dunedin, Florida, CAN; Toronto Blue Jays first baseman Vladimir Guerrero Jr. (right) reacts after hitting an RBI single during the first inning against the Boston Red Sox at TD Ballpark. Mandatory Credit: Nathan Ray Seebeck-USA TODAY Sports

J.D. Martinez hit a two-run home run with two out in the ninth inning and the visiting Boston Red Sox defeated the Toronto Blue Jays 8-7 Thursday night at Dunedin, Fla.

Martinez hit his 12th homer of the season against Rafael Dolis (1-1) and had three RBIs in the rubber match of the three-game series.

Bobby Dalbec, who had a three-run homer, led off the ninth with a single. Michael Chavis followed with a single. The runners advanced to second and third on a wild pitch. Dalbec scored on Alex Verdugo’s groundout before Martinez came to bat.

Phillips Valdez pitched (2-0) 1 1/3 innings to get the win. Matt Barnes pitched around a walk in the ninth with three strikeouts to earn his 10th.

Toronto left-hander Steven Matz allowed five runs and 10 hits in six innings.

Boston right-hander Nick Pivetta allowed five runs (four earned) and seven hits while striking out eight in five innings.

Toronto scored twice in the first inning on doubles by Bo Bichette, Vladimir Guerrero Jr. and Randal Grichuk.

The Red Sox responded with five runs in the second with seven consecutive two-out hits. The third hit of the rally was Dalbec’s fifth homer this season. Enrique Hernandez and Martinez added RBI singles.

Related: MLB power rankings – Best teams entering MLB postseason

The Blue Jays scored once in the bottom of the second when Marcus Semien singled with two out and scored on Bichette’s double.

Toronto tied the game at 5-5 on two fifth-inning runs. Semien led off with a walk, took third on Guerrero’s one-out single and scored on an error by third baseman Rafael Devers on Teoscar Hernandez’s bouncer. Cavan Biggio grounded a two-out RBI single.

The Blue Jays scored twice against Hirokazu Sawamura in the sixth. Danny Jansen led off with a double and continued to third on an error by right fielder Hunter Renfroe. Jonathan Davis hit a single to give Toronto a 6-5 lead. Bichette walked with one out. Second baseman Chavis dropped a throw from shortstop Xander Bogaerts for the second error of the inning and Grichuk looped an RBI single to right.

Tyler Chatwood and Jordan Romano were perfect for Toronto in the seventh and eighth, respectively.

Lourdes Gurriel Jr (knee) did not play on Thursday.

–Field Level Media