TORONTO — When they aren’t piling up double-digit run totals, the Boston Red Sox can’t seem to score much at all.

J.A. Happ got his 18th win, Melvin Upton Jr. hit a two-run homer and the Toronto Blue Jays snapped a four-game losing streak Saturday by beating Boston 3-2, closing within one game of the AL East leader.

Boston dropped to 5-3 on a nine-game trip. The Red Sox have scored three runs combined in the three defeats.

Happ (18-4) allowed two runs and four hits in six-plus innings to win for the first time since Aug. 17 at the New York Yankees, ending a three-start winless streak. He didn’t allow a hit until Chris Young’s one-out single to center in the fifth.

“Many, many times we’ve shown the ability to put up a quality offensive game,” Red Sox Manager John Farrell said. “He shut us down today.”

Dustin Pedroia homered leading off the sixth and has a 28-game hitting streak against the Blue Jays.

“He’s tough,” Pedroia said of Happ. “His fastball gets on you, he locates real well, he’s got late movement on his offspeed stuff. It just wasn’t our day.”

The lack of offense proved costly to Red Sox left-hander Eduardo Rodriguez, who allowed three runs, two earned, and four hits in six innings. Rodriguez (2-7) is winless in nine starts but has allowed more than three earned runs just once in that stretch.

“He more than did his job against that lineup to give us an opportunity to win,” Farrell said.” Offensively we just couldn’t get anything going.”

Toronto, whose players met behind closed doors for about an hour before the game, avoided matching its longest skid this season.

“It was a big win, no doubt,” Happ said. “We had better energy than we’ve had in a while today. From first pitch to last it seemed like our dugout was really into this one.”

Upton and Devon Travis made costly errors in Friday’s 13-3 loss but followed with good days Saturday. Travis had three hits for the Blue Jays and is 6 for 9 in the first two games of the series. Upton hit his 20th homer, a two-run drive in the second.

“Two guys who took a lot of heat last night came through for us,” Manager John Gibbons said.

Upton has 25 stolen bases and reached the 20-20 mark for the fourth time.

Jose Bautista made it 3-0 in the third with an RBI bloop single just beyond the reach of shortstop Xander Bogaerts.

Happ left after back-to-back singles by Hanley Ramirez and Aaron Hill put runners at the corners in the seventh. Joaquin Benoit gave up a sacrifice fly to Jackie Bradley Jr., then struck out pinch-hitter Travis Shaw.

Roberto Osuna finished for his 31st save in 34 chances, striking out Bradley with a man on for the final out.

NOTES: Boston relievers haven’t allowed an earned run over 142/3 innings in September. … Red Sox outfielder Andrew Benintendi (left knee) will try sliding in a simulated game Tuesday, Farrell said. It’s expected to be Benintendi’s final test before coming off the DL.