TORONTO -- The San Diego Padres extended their home run streak to 24 consecutive games Tuesday night and had a right to think that it would be enough to earn a win against the Toronto Blue Jays.

Matt Kemp hit a two-run homer in the top of the 12th inning against Jesse Chavez to hand San Diego a 6-4 lead.

However, the Blue Jays came back with a three-run bottom of the 12th, with the winning run scoring on a wild pitch, to defeat the Padres 7-6.

"It was a crazy game," Blue Jays manager John Gibbons said. "It was a big, big win for us there for us late. After falling behind by two, we came back and gutted it and competed. That's all you can ask for. I'm proud of the guys."

Russell Martin led off the bottom of the 12th with a single against Carlos Villanueva (1-2) and was forced at second on a grounder to short by Kevin Pillar.

Darwin Barney doubled to left-center to put runners at second and third.

Devon Travis fouled off eight pitches on a full count before walking to load the bases.

"It's unbelievable, especially coming from one the young guys," Blue Jays starting pitcher Marcus Stroman said of Travis' at-bat. "That moment, that atmosphere, to grind out an at-bat like that, it shows the composure Devon has."

Paul Clemens came in and walked Jose Bautista to force in a run. Josh Donaldson's grounder to second forced Bautista at second while the tying run scored. Travis scored from third on Clemens' wild pitch.

"It's a tough way to lose a baseball game," Padres manager Andy Green said. "It is a frustrating loss, especially how hard the guys battled back on a couple of occasions."

Donaldson and Justin Smoak homered for the Blue Jays (57-44).

Kemp and Alex Dickerson homered for the Padres (43-58).

Chavez (1-2) entered the game in the 10th and retired his first eight batters before allowing a two-out double to Wil Myers. Kemp followed with his 23rd home run of the season.

San Diego right-hander Andrew Cashner allowed four hits, three walks and three runs while striking out six in six innings.

"I thought I could have been a little more efficient earlier in the game," Cashner said. "There's definitely a lot of distractions (with trade rumors). You just try to put them to the side. It's definitely sad seeing the (turnover) every year. You'd definitely like to see more guys stay here longer in their careers. That's just kind of how it's been since I've been here."

Stroman allowed seven hits, one walk and four runs in 6 2/3 innings. The right-hander struck out seven.

Dickerson hit a three-run homer on a 1-1 curveball in the sixth to give the Padres a 4-3 lead.

It was a club-record 24th straight game in which the Padres homered. The last streak to go longer in the majors came in 2002, when the Texas Rangers homered in 27 games in a row.

The two-out homer followed a leadoff single by Travis Jankowski and a one-out single by Kemp. Dickerson has just five home runs this season, but he has homered three games in a row.

"I thought Stroman was good," Gibbons said. "He gave up that three-run homer, but other than that, he pitched really well."

Stroman said, "Felt great, felt strong, felt I could throw the ball where I wanted to. It was just that one pitch."

Left-hander Brad Hand replaced Cashner in the bottom of the seventh and walked his first two batters, Martin and Pillar.

Melvin Upton Jr., obtained Tuesday in a trade with the Padres, pinch-hit for Smoak and forced Pillar at second with a grounder to first. Upton took second and Martin held at third on a wild pitch. Travis trickled an infield single to third to load the bases.

Bautista struck out swinging on a wild pitch that allowed the tying run to score.

Bautista led off the bottom of the first with a walk and Donaldson followed with his 25th homer of the season, a drive to center on a 2-2 fastball.

The Padres scored once in the top of the second on a leadoff single Yangervis Solarte and a one-out double by Schimpf.

Smoak opened the fifth with his 12th homer of the season, launching a 2-2 fastball to center.

The Blue Jays announced after the game that they acquired right-hander Joaquin Benoit from the Seattle Mariners for right-hander Drew Storen, who had been designated for assignment, and cash.

NOTES: Toronto OF Melvin Upton Jr. was not in the Blue Jays' starting lineup Tuesday after being acquired in a trade that sent Class A RHP Hansel Rodriguez to San Diego. Upton had to return to Buffalo, N.Y., about a 90-minute drive away, and re-enter Canada to obtain a new work visa. He joined his new team about two hours before the start of the game. Toronto manager John Gibbons said Upton likely would start Wednesday against the Padres with RF Jose Bautista given a game at DH. RHP Ryan Tepera was optioned to Triple-A Buffalo to make roster room for Upton. ... Padres RHP Andrew Cashner, who started Tuesday, previously had never pitched against the Blue Jays but had been used as a pinch runner against them on June 2, 2013 at Petco Park. ... Padres RHP Luis Perdomo (4-4, 6.93 ERA) will face Blue Jays RHP R.A. Dickey (7-11, 4.44 ERA) in the series finale Wednesday afternoon.