TORONTO -- Aledmys Diaz drove in Russell Martin in the 10th inning to give the Toronto Blue Jays an 8-7 walkoff victory over the Baltimore Orioles on Friday night at the Rogers Centre.

Diaz hit a sharp grounder that deflected off the glove of Baltimore third baseman Renato Nunez. Shortstop Tim Beckham couldn't come up with it and the ball rolled into left field, allowing Martin to score.

Martin had reached on a two-out infield single off left-hander Paul Fry (0-1), who walked Randal Grichuk before giving up Diaz's fourth hit of the night.

Diaz, Martin and Grichuk all homered for the Blue Jays and starter Sam Gaviglio posted career highs of 7 2/3 innings pitched and eight strikeouts.

Toronto reliever Tyler Clippard blew a three-run lead in the ninth inning, allowing homers by Caleb Joseph and a tiebreaking solo shot from Jonathan Schoop.

Toronto outhit Baltimore 11-10 as the Blue Jays (44-52) took the opener of the three-game series. The Blue Jays evened their home record at 25-25 on the season.

John Axford (3-1) threw a clean 10th inning for the win. The last-place Orioles fell to 28-70.

Gaviglio retired the first six Orioles he faced before rushing a throw to first on Trey Mancini's hard comebacker to open the third inning. Mancini took second base on the error but was left stranded.

Diaz put the Blue Jays on the board in the third with a solo homer off Baltimore starter Dylan Bundy. It was his ninth home run of the season.

Beckham hit a two-run blast in the fifth that was promptly answered with back-to-back solo shots in the bottom half by Martin and Grichuk. Beckham has three homers on the year while Martin has seven and Grichuk has 12.

Toronto made it a four-run frame after Teoscar Hernandez drove in Devon Travis with a sacrifice fly and Justin Smoak doubled to plate Curtis Granderson.

Bundy allowed five earned runs and five hits over five innings. He walked one and struck out three.

Toronto tacked on a pair of runs in the seventh off Baltimore reliever Mychal Givens. The Orioles cut into the lead in the eighth when Chris Davis hit a two-run shot, his 10th of the year, to chase Gaviglio.

It was Gaviglio's first career start against Baltimore. He allowed four earned runs, seven hits and one walk.

After giving up Joseph's second homer of the year, Clippard struck out Beckham before Schoop launched his 11th homer of the season.

Announced attendance was 31,115 and the game took three hours one minute to play.

Notes: The Blue Jays recalled infielder Richard Urena from triple-A Buffalo before the game. ... Highlights of Toronto pitcher J.A. Happ's performance at the all-star game were played on the big screen in the first inning. Happ threw one inning for the save in the American League's 8-6 win over the National League. ... Baltimore will send Alex Cobb (2-12, 6.41 earned-run average) to the mound Saturday against Marcus Stroman (2-7, 5.86). It will be Stroman's first appearance since a profanity-laced post-game media availability with reporters in Boston before the all-star break. Stroman declined an interview request Friday.