TORONTO (AP) -- Steve Geltz got Toronto star Josh Donaldson to swing and miss at his first pitch. The next one he threw, that one didn't go so well for the Tampa Bay reliever.
Donaldson hit a solo home run off Geltz with two outs in the bottom of the ninth inning, connecting for No. 41 this year and sending the playoff-bound Blue Jays over the Rays 5-4 Sunday in their final home game of the regular season.
Facing Geltz, who hadn't pitched since Sept. 20, Donaldson swung and missed on a first-pitch slider.
"I was like, `OK, he's real aggressive here. I don't want to give him anything straight to hit,'" Geltz said. "Then I left one too much in the middle."
Rays manager Kevin Cash acknowledged it wasn't easy for Geltz to shake off his rust against Toronto's powerful lineup.
"Not the ideal split to stick him into given his lack of workload recently," Cash said.
The Blue Jays, already set to make their first postseason appearance since 1993, have a magic number of four to clinch the AL East title.
Justin Smoak had three hits, including a two-run homer, as the Blue Jays finished an AL-best 53-28 at home.
Brett Cecil (4-5) pitched the top of the ninth, then Donaldson delighted the crowd of 47,287 at Rogers Centre with his drive.
Geltz has pitched in 69 games this season, a Rays rookie record, but this one didn't end the way he wanted.
"It's always tough any time you go out there and give the game up and let your team down," Geltz said. "It's not a very enjoyable walk off."
It was the third time this season that Donaldson has delivered a game-ending home run.
"Ever since I was young, I've always looked forward to those big moments in the game," Donaldson said. "I want to be able to come through."
Donaldson leads the majors in RBIs (122) and runs (121). Colorado's Nolan Arenado entered play Sunday with 121 RBIs.
Brandon Guyer tripled on Mark Buehrle's first pitch of the game and scored on a two-out single by Logan Forsythe as the Rays grabbed an early lead.
Toronto tied it in the bottom half on Smoak's two-out RBI double.
Rays pitchers retired the next 12 batters until Darwin Barney doubled off Enny Romero in the fifth.
After Guyer was hit by a pitch in the third, extending his club record total to 21, Mikie Mahtook followed with his sixth homer.
Toronto cut it to 4-3 against Brandon Gomes in the sixth when Edwin Encarnacion walked and Smoak followed with a second-deck drive to right, his 17th.
The Blue Jays tied it against Alex Colome in the eighth. Smoak singled with one out and was replaced by pinch runner Dalton Pompey. After Dioner Navarro flied out, Pompey stole second and scored on Kevin Pillar's double.
Buehrle allowed four runs and five hits in six innings. He has reached at least 200 innings in 14 straight seasons, and is at 191 1-3 with at least one start remaining.
Making his first start since July 7, right-hander Matt Andriese allowed one run and two hits in three innings. He threw 54 pitches, 33 strikes.
Tampa Bay finished 38-40 on the road, the first time since 2010 they haven't been at least .500 away from home. The Rays played an abbreviated road schedule when a series against the Orioles was moved to Tropicana Field because of civil unrest in Baltimore.
Rays: Jake McGee pitched first for the first time since Aug. 18. McGee (left knee) was activated off the DL Saturday.
Blue Jays: SS Troy Tulowitzki (broken left shoulder blade) said he's "full go" when it comes to running and throwing, but remains unable to swing the bat without pain. If possible, Tulowitzki said he would like to get into a game before the end of the regular season.
Rays: Tampa Bay is off Monday before opening its final homestand of the season with a three-game series against Miami on Tuesday. LHP Matt Moore (2-4, 6.48 ERA) starts for the Rays against Marlins LHP Adam Conley (4-1, 3.93). Moore beat Boston in his previous start to win for the first time since July 12.
Blue Jays: Toronto begins its last road trip of the season Monday with the opener of a four-game series in Baltimore. RHP Marco Estrada (13-8, 3.13 ERA) faces Orioles RHP Chris Tillman (10-11, 5.16). Estrada is unbeaten in five starts.