TORONTO — In the middle of August, Alexei Ramirez hit a home run off Rays left-hander Drew Smyly.

Almost a month later, Ramirez connected again, this time helping give Smyly a win.

Smyly pitched 5 2/3 innings to remain unbeaten at Rogers Centre, Ramirez and Steven Souza Jr. hit home runs and Tampa Bay beat the Toronto Blue Jays 6-2 on Tuesday night.

Ramirez’s home run was his first since signing with Tampa Bay after being released by San Diego earlier this month. His previous homer, on Aug. 15, was a solo shot off Smyly at Tampa Bay when Ramirez was still with the Padres.

“When he came over here, I was like ‘I know you remember that home run off me'” Smyly said. “He’s a good hitter, man. He’s been around for 10 years.”

Ramirez wasn’t sure what his future held when San Diego cut him loose, but he’s happy for the chance he’s been given.

“I thought it might have been the end of my season,” he said through a translator. “Here I am with an opportunity.”

The Blue Jays dropped into a tie with the Orioles for the AL wild-card spots. Toronto and Baltimore are two games behind Boston in the East.

The Rays have won seven of their last 11 games against the Blue Jays.

“If we could harness that and play the rest of the league like that, we’d be a pretty good ball club,” Souza said.

Ramirez hit a three-run homer off Marcus Stroman (9-8) in the fifth, and Souza drilled a solo shot off Joe Biagini in the seventh.

Russell Martin had a two-run shot, but Toronto lost for the eighth time in 11 September games.

“It just wasn’t our night,” Martin said.

Smyly (7-11) came in 3-0 with a 1.23 ERA at Rogers Centre in five appearances, including three starts. He allowed two runs and five hits.

“That’s a really tough lineup,” Smyly said. “Every time you face them, you know you have to be on point, you have to be commanding the ball well.”

Toronto loaded the bases with two outs in the seventh, but Edwin Encarnacion struck out against Danny Farquhar.

“I elevated a fastball and luckily he swung,” Farquhar said.

The Blue Jays were without reigning AL MVP Josh Donaldson for the second straight game. Donaldson is day to day with a sore right hip and hopes to return Wednesday.

Toronto has scored three runs or fewer in six of its past eight.

Martin chased Smyly with a two-out blast into the second deck in the sixth.

Stroman allowed three runs and four hits in six innings. The right-hander is winless in five starts since a home victory over Houston on Aug. 14.

“I thought he was good,” manager John Gibbons said. “We just came up short.”

DRAWING A CROWD

The crowd of 38,338 put Toronto over the three-million mark for the sixth time in franchise history and the first time since 1993. The Blue Jays have averaged an AL-best 41,460 this season. They have eight home games remaining.

POWER BALL

The Rays have hit 14 homers in their past six games. They need one more to match the team’s single-season record of 199, set in 2009. The Rays have hit at least one home run in 16 of their 18 meetings with Toronto this season.

TRAINER’S ROOM

Rays: LHP Xavier Cedeno is still bothered by a sore neck and will likely see a doctor when the team returns to Florida. Cedeno hasn’t pitched since Aug. 29.

Blue Jays: Gibbons said Donaldson jammed his hip when he stepped on first base in Sunday’s loss to Boston. The three-time All-Star third baseman is stuck in a career-worst seven game hitless streak. He’s 0 for 23 with seven strikeouts in that span.

UP NEXT

Rays RHP Alex Cobb (0-0, 4.09) starts against Blue Jays RHP Marco Estrada (8-8, 3.68) in Wednesday afternoon’s series finale. Cobb will make his third start since returning from elbow surgery. He’s 1-1 with a 5.56 ERA in two career starts at Toronto. Estrada lasted a season-low 2 1/3 innings in Friday’s loss to Boston.