TORONTO (AP) After Devon Travis came within a few feet of a game-winning home run, he found a different way to circle the bases.

Travis scored the winning run on a wild pitch, and the Toronto Blue Jays rallied for three runs in the 12th inning to beat the San Diego Padres 7-6 on Tuesday night.

Matt Kemp put the Padres in front with a two-run homer off Jesse Chavez (1-2) in the top of the 12th, but San Diego's bullpen couldn't hold the lead.

More from FoxSports

Travis drew a 14-pitch walk to load the bases, bringing Paul Clemens on in relief of Carlos Villanueva (1-2). Travis fouled off eight straight pitches, including one drive that sailed just wide of the left-field foul screen.

''That's as good as it gets,'' Blue Jays manager John Gibbons said.

Clemens walked Jose Bautista to make it 6-5 before Josh Donaldson tied it with a fielder's choice grounder.

With Edwin Encarnacion batting, a pitch bounced away from catcher Derek Norris, and Travis slid in headfirst just ahead of the tag as his teammates stormed out of the dugout to celebrate.

''I know (Clemens) has a really good curveball, a really sharp one,'' Travis said. ''I was praying for in the dirt. It took a bad bounce, but a good bounce for us.''

Gibbons called it ''a crazy game.''

''I'm proud of the guys,'' he said. ''They keep gutting it out, competing.''

It was the second key run to score on a wild pitch: Toronto catcher Russell Martin made it 4-all when he scored on Brad Hand's wild pitch in the seventh.

''It is a frustrating loss, especially how hard the guys battled back on a couple of occasions,'' Padres manager Andy Green said.

Donaldson hit a two-run homer and Justin Smoak had a solo shot for the Blue Jays.

Alex Dickerson hit a three-run shot, his third homer in three games, as San Diego extended its club-record streak of games with at least one home run to 24. It's the longest run since the 2002 Texas Rangers set a major league record by homering in 27 straight.

Donaldson connected off Andrew Cashner in the first, his 25th, but San Diego halved the deficit on Ryan Schimpf's RBI double in the second.

Smoak's leadoff homer in the fifth put Toronto up 3-1, but Marcus Stroman couldn't hold the lead, giving up Dickerson's homer in the sixth.

Outfielder Melvin Upton Jr., traded from San Diego to Toronto before the game, made his Blue Jays debut as a pinch hitter in the seventh. He grounded into a fielder's choice.

WHEELING AND DEALING

Toronto announced another trade minutes after the game ended: The Blue Jays acquired reliever Joaquin Benoit from the Seattle Mariners for right-hander Drew Storen. Benoit, who turned 39 on Tuesday, is 1-1 with a 5.18 ERA in 26 games this season.

WORKING OVERTIME

The Blue Jays and Padres have played extra innings three times in their past five meetings. The first of those games lasted 17 innings.

REPEAT PERFORMANCE

Donaldson is the first third baseman in Blue Jays history to post consecutive 25-homer seasons.

HIT PARADE

Blue Jays RHP Roberto Osuna hit two batters with pitches in the ninth, matching the number he'd hit in 114 previous career innings pitched.

TRAINER'S ROOM

Padres: Class-A RHP Chris Paddack, acquired from Miami in last month's trade for Fernando Rodney, has been sidelined indefinitely with a strained forearm.

Blue Jays: Gibbons said Jose Bautista will be the DH on Wednesday, allowing Upton to make his first start for Toronto.

UP NEXT

Padres: RHP Luis Perdomo (4-4, 6.93 ERA) will make his first career appearance against Toronto. He has allowed three earned runs or fewer in six of his past seven starts.

Blue Jays: RHP R.A. Dickey (7-11, 4.44) will start on three days' rest, with RHP Marco Estrada getting pushed back to Friday. Estrada (back) was on the disabled list from July 3 to July 21. Dickey has lost his past two starts.