TORONTO - Freddy Galvis hit a two-run homer as part of a four-run fifth inning as the Toronto Blue Jays' offence ignited to beat the New York Yankees 4-3 on Tuesday.

Randal Grichuk also went deep for the Blue Jays (22-38), who snapped a six-game slide, and Vladimir Guerrero Jr. hit a run-scoring single. Eric Sogard was 3 for 4 with a double.

Reliever Daniel Hudson (4-2) earned the win while Ken Giles earned a four-out save.

Clint Frazier and Aaron Hicks homered for the Yankees (38-21) in the first meeting between the two division rivals this season. Masahiro Tanaka (3-5) allowed four runs and six hits with two walks and two strikeouts.

Toronto starter Clayton Richard gave up two runs and four hits with three walks and four strikeouts over 4 2/3 innings. He threw 87 pitches, 52 for strikes.

It was the veteran left-hander's third start as a Blue Jay after missing eight weeks with a knee injury. He hasn't won a decision since June 22, 2018 with the San Diego Padres.

The Blue Jays, whose offence has sputtered all season, came into the game ranked last in the American League in batting average (.218), on-base percentage (.285), on-base plus slugging (.660), and second-last in slugging (.375) and runs per game (3.75).

They've had an especially rough go lately, with back-to-back sweeps on their recent six-game road trip that saw them outscored 37-16.

Toronto scored all their runs in the fifth to take the lead. Grichuk led off the inning with a solo shot, Galvis hit a two-run blast that followed an overturned caught-stealing call on rookie Cavan Biggio, and Guerrero drove in a run on a single.

Biggio had been called out trying to steal second base and was already running back to the Jays dugout before the call was overturned by video review.

Frazier put the Yankees on the board in the fourth inning with a no-doubt blast over the left-field fence. The homer, which followed a Hicks double, was Frazier's 11th of the season and gave New York a 2-0 lead.

Hicks' second hit of the game was a solo shot in the eighth that brought the Yankees within a run.

Toronto escaped a jam in the sixth when reliever Thomas Pannone walked two batters to start the inning. Hudson replaced him on the mound and got the three outs.

NOTES: Canadian golfer Nick Taylor threw out the ceremonial first pitch. ... The Blue Jays reinstated left-hander Tim Mayza from the injured list before the game. ... Canadian left-hander James Paxton, who tossed a no-hitter with Seattle in his last start at Rogers Centre on May 8, 2018, starts the second game of the three-game series for the Yankees Wednesday.