TORONTO -- Marco Estrada is used to pitching with a persistent lower-back injury and has found the longer he goes, the better he pitches.

The Toronto Blue Jays had three solo homers in the first inning to give Estrada some breathing room and scored three more runs in the third to pick up a 6-5 victory over the Baltimore Orioles at Rogers Centre on Friday night.

Estrada (6-4) went six innings and gave up three earned runs in striking out six to register his first win since beating the Philadelphia Phillies on June 15.

"Obviously that back thing's still there," Estrada said.

"It's lingering and I don't feel 100 per cent yet but I still feel like I can give the team some innings and some quality innings. Early on, it's tough. Once I loosened up, I was able to pitch a little bit better but I've just got to find a way to get my back loose early on."

Jose Bautista led off the game with his 13th of season and first since coming off the disabled list on Monday. Edwin Encarnacion and Troy Tulowitzki also homered in the first as the Jays knocked three out in one inning for the second time this season.

Toronto (58-45) is now just a half game back of the Orioles (58-44) for the division lead in the American League East.

Kevin Gausman (2-8) had an adventurous three-inning start. In addition to the three homers surrendered in the first, he also walked three Blue Jays and threw two wild pitches.

"Really, the whole game I was just kind of out of whack. I was all over the place," said Gausman.

"If you don't have your A game, they're going to let you know."

Estrada surrendered runs in the first, third and fourth innings but retired the Orioles in order in his final two innings of work.

Baltimore scored twice in the first inning and then tied the game in the third thanks to some opportunistic base-running from Manny Machado.

Machado had been on first with a one-out base hit and moved to second on Chris Davis' ground out to the right side. But the Blue Jays had shifted third baseman Josh Donaldson to cover the hole on the right side and that left third base open.

Catcher Russell Martin tried to cover third but spilled Justin Smoak's throw and nobody covered home, allowing Machado to score.

"It's a very weird play because certain guys you shift and certain guys you don't. Ideally, with two outs you maybe just eat the ball but guys are trying to make plays," said Jays manager John Gibbons.

"It's such a rare play. You might not see it again and sometimes it can catch you off-guard."

In front of 46,112 fans, the Jays broke the tie in the home half of the third with Tulowitzki, Martin and Kevin Pillar all driving in runs.

Machado made it a one-run game on the first pitch of the eighth with his 22nd homer of the season off Jason Grilli. Roberto Osuna came on in the ninth and surrendered a two-out double to J.J. Hardy but got Adam Jones to ground out for his 22nd save.