OAKLAND, Calif. -- Josh Donaldson hit a tiebreaking two-run double with two outs in the ninth against his former team and the Toronto Blue Jays held on for a 5-3 win over the Oakland Athletics on Sunday to avoid a three-game sweep.

Troy Tulowitzki homered while Russell Martin and Justin Smoak added two hits apiece for the Blue Jays.

Donaldson, traded from Oakland to Toronto prior to the 2015 season, also singled and scored in the first inning to help the Blue Jays win after A's starter Rich Hill left the game with a blister on his finger in the first inning.

The Blue Jays needed the victory after losing their first two games coming out of the All-Star break to fall four games behind first-place Baltimore in the AL East.

Marcus Semien homered for the A's.

Smoak and Junior Lake hit consecutive one-out singles off John Axford (3-3) in the ninth. Devon Travis struck out looking before Donaldson lined a 2-1 pitch down the left field line to drive in pinch-runner Andy Burns and Lake.

Jason Grilli (3-1) retired three batters for the win. Roberto Osuna pitched the ninth for his 19th save.

Tulowitzki hit his 16th home run of the season off Sean Manaea in the fourth. It was Tulowitzki's eighth home run in 23 games since coming off the disabled list June 17.

Semien homered and Yonder Alonso added a tying pinch-hit two-run double in the sixth.

Hill, a potential trade candidate whose outing attracted several major league scouts, was removed after throwing just five pitches. The lefty had been scratched from a scheduled start on Friday because of a blister.

Hill's replacement, Andrew Triggs, was hit in the leg by a line drive from Josh Donaldson moments later. Triggs finished the inning, giving up an unearned run when left fielder Khris Davis misplayed Edwin Encarnacion's single for an error, before Melvin brought in Manaea.

Oakland used seven pitchers overall.

Toronto starter J.A. Happ also got hit twice, including once near his left elbow by Jake Smolinski's liner in the fifth. The Blue Jays' lefty allowed three runs over 5 2/3 innings with five strikeouts and one walk.