TORONTO — Devon Travis beat out an infield hit with two outs in the bottom of the ninth and the Toronto Blue Jays came back twice to defeat the Boston Red Sox 10-9 on Saturday afternoon.

The Blue Jays tied the game on a single by Jose Bautista to cap a four-run eighth, then Boston’s David Ortiz hit his 13th homer of the season with one out in the top of the ninth against right-handed reliever Gavin Floyd (2-3), who finished the inning to get the win.

Russell Martin, who also had a homer and a single, tied the game in the bottom of the ninth with a double, took third on a wild pitch and scored the winning run on the hit to third by Travis. Martin had three RBIs as Toronto (26-25) made it two in a row over Boston.

Xander Bogaerts extended his hit streak to 21 games with a homer and two singles, Hanley Ramirez drove in three runs for the Red Sox (29-20).

Craig Kimbrel (0-2), who allowed Bautista’s game-tying hit and two runs in the ninth, took the loss.

Travis Shaw added a two-run homer for Boston and Dustin Pedroia also had a two-run double against Blue Jays starter Marcus Stroman, who allowed 11 hits and seven runs.

Boston right-hander Rick Porcello allowed seven hits and four runs in 6 2/3 innings. He walked one and struck out five.

Home plate umpire Mike DiMuro left the game during the second inning after a foul ball by Blue Jays second baseman Devin Travis knocked him down. He walked off the field accompanied by a trainer and Brian Gorman moved behind the plate.

The Blue Jays took a 3-0 lead in the third.

Darwin Barney and Kevin Pillar hit doubles to right. Bautista blooped a single to center to put runners at the corners. Josh Donaldson walked. Edwin Encarnacion was hit by a pitch to force in a run. The Red Sox challenge to the call was thrown out after 35 seconds. The third run scored when Michael Saunders grounded into a double play.

Bogaerts led off the fourth inning with his sixth homer of the season to extend his hitting streak to 21 games.

Ortiz doubled to left and Ramirez walked. Jackie Bradley Jr. lined to short and Barney flipped to Travis to double Ortiz off second. Shaw lined out to third.

The Red Sox scored four runs in the fifth to take a 5-3 lead with Pedroia, with a double, and Ramirez, with a single, each driving in two runs.

Christian Vazquez started the rally with a one-out double and Mookie Betts followed with an infield single. After Pedroia doubled to tie the game, Bogaerts singled and stole second. Ortiz struck out and Ramirez singled to left to put Boston into the lead and was thrown out trying for a double.

Bradley led off the sixth with a double and Shaw hit his seventh homer of the season to extend the lead to 7-3. Right-hander Jesse Chavez got the final two outs of the inning. Stroman finished with one walk and five strikeouts.

Martin hit his third homer of the season — and of the week — with two out in the bottom of the sixth.

Bogaerts led off the seventh with a single to center, his third hit of the game, and he continued to second on Pillar’s error. After a wild pitch, Ramirez hit an RBI single. Left-hander Aaron Loup replaced Chavez and finished the inning with two strikeouts.

Left-hander Tommy Layne replaced right-handed reliever Matt Barnes in the eighth. He hit Saunders with a pitch. Saunders was called safe at second on Justin Smoak’s fielder’s choice grounder to shortstop.

Right-hander Junichi Tazawa replaced Layne and gave up an RBI single to Martin and an RBI double to Travis. Pinch hitter Jimmy Paredes struck out but a wild pitch during his at-bat allowed a run to score to cut Boston’s lead to one.

Kimbrel struck out Pillar before Bautista singled to right to tie the game.

Kimbrel allowed a two-out single to Smoak in the ninth. Pinch runner Ezequiel Carrera stole second and advanced to third on a throwing error by the catcher, Vazquez. Martin doubled to tie the game. Martin took third on a wild pitch and the winning run scored on an infield hit to third by Travis.

NOTES: Blue Jays SS Troy Tulowitzki (right quadriceps strain) was put on the disabled list Saturday and LHP Aaron Loup (elbow strain) was activated from the DL. Tulowitzki was injured in the opening game of the three-game series at Yankee Stadium on Tuesday, missed two games, and returned to play Friday in the 7-5 win over the Boston Red Sox. Loup has not played with Toronto this season after being injured during spring training. He completed his minor league rehabilitation assignment with Triple-A Buffalo. … Red Sox manager John Farrell said RHP Clay Buchholz could be ready to pitch out of the bullpen as early as Sunday. He has been removed from the rotation after going 2-5 with a 6.35 ERA in 10 starts. … Red Sox LHP David Price (7-1, 5.34 ERA) will start the finale of the three-game series Sunday against Blue Jays RHP R.A. Dickey (2-6, 4.60).