BALTIMORE — Matt Wieters hit a go-ahead, two-run homer off Jason Grilli in the eighth inning to lead the Baltimore Orioles to a 5-3 victory over the Toronto Blue Jays on Tuesday night.

The Orioles pulled within three games of the first-place Blue Jays, who had a four-game winning streak snapped. After losing the opener 5-1, the Orioles will look to gain more ground in the series finale Wednesday.

Michael Saunders drilled a two-run shot off Orioles starter Ubaldo Jimenez that tied the game 3-3 in the seventh.

In the eighth, Jonathan Schoop walked and Wieters homered off Grilli (4-2), his 12th of the season.

Brad Brach (8-2) picked up the win with 1 1/3 scoreless innings. Zach Britton got his league-leading 39th save.

Blue Jays left-hander J.A. Happ fell short of tying Boston’s Rick Porcello for the major league lead with 18 wins. Happ allowed three runs and six hits with three strikeouts over 6 1/3 innings.

Manny Machado hit his 34th homer of the season and 100th of his career for Baltimore. Steve Pearce went deep for the 13th time this season.

Baltimore’s Pedro Alvarez, who got a rare start against a left-hander, managed two hits against Happ and is 6 for 12 in his career against him.

Jimenez started in place of the injured Chris Tillman and allowed three runs and nine hits with three strikeouts over 6 2/3 innings.

The Blue Jays took a 1-0 lead in the second on a two-out, RBI single by Kevin Pillar. Jimenez then retired the next eight batters before allowing another single to Pillar in the fifth.

Pearce tied the game 1-1 with a homer in the bottom half of that inning. Two batters later, Machado drove Happ’s 0-1 pitch over the wall in center field for a two-run homer that gave Baltimore the lead.

MOVES

Orioles: RHP Logan Ondrusek and OF Julio Borbon were outrighted to Double-A Bowie. Both players were designated for assignment over the weekend and cleared waivers.

TRAINER’S ROOM

Orioles: CF Adam Jones performed drills but was held out of the lineup for the fourth consecutive game with a left hamstring strain. … Tillman (right shoulder bursitis) could potentially throw off a mound this weekend. However, the original target dates of Sept. 9 or 10 for his next start appear unlikely, manager Buck Showalter said.

UP NEXT

Blue Jays: Aaron Sanchez (12-2, 2.99 ERA) will be recalled from Class-A Dunedin to make the start. He spent the past 10 days in the minors to limit his innings. Sanchez has gone 2-0 with a 4.50 ERA in three starts against Baltimore this season.

Orioles: Yovani Gallardo (4-6, 5.59 ERA) has lost his past three decisions. In his last outing against the Yankees, he lasted just 1 1/3 innings, allowing eight runs and six hits.