OAKLAND, California — The Boston Red Sox had lost three straight and were in danger Sunday of being swept by the Oakland Athletics in a four-game road series for the first time since 1932, when the A’s played at Shibe Park in Philadelphia.

Red Sox left-hander Eduardo Rodriguez and longtime A’s killer Mitch Moreland made sure that didn’t happen.

Rodriguez pitched eight strong innings, and Moreland hit a two-run homer, lifting the Red Sox to a 12-3 victory at Oakland Coliseum.

Rodriguez (3-1) allowed three runs and six hits in his second career start against the A’s. He struck out eight, walked one and had his sixth straight quality start, needing just 98 pitches.

“I just feel more confident,” Rodriguez said. “I feel like I can throw all my pitches right where I want. That’s what gave me a good start.”

In his first career start against the A’s last season on Sept. 4 at the Coliseum, Rodriguez had a no-hitter through 7 2/3 innings before giving up an infield single on a comebacker to Marcus Semien.

“I wasn’t thinking about that,” Rodriguez said. “I just went out there and tried to do my best to put the team in position to win the game.”

Moreland hit his 19th career home run against the A’s, 14 of those coming at the Coliseum in just 45 games. The former Texas Rangers slugger broke a tie with the Angels’ Mike Trout for most homers at the Coliseum by a visiting player since 2010.

Moreland homered against Oakland in each of the three games he played in this series. This time, he launched Andrew Triggs’ 1-1 fastball into the second deck in right field for a two-run shot in the sixth inning, extending Boston’s lead to 6-3.

“I’ve always had a little success, especially with the homers here,” said Moreland, who spent seven seasons with Texas before coming to Boston as a free agent this year. “I don’t know if it’s just feeling comfortable or what it is. It just seems like it happens here.”

Hanley Ramirez went 3-for-4 with a two-run double in a five-run ninth inning and scored twice for the Red Sox, who pounded out 15 hits.

Dustin Pedroia went 2-for-5 with an RBI and a run, hitting safely against Oakland for the 24th consecutive game, the longest such streak in Red Sox history.

Chad Pinder went 2-for-4 with a double and two-run homer for the A’s. It was his fifth blast of the season in just 21 games and came in his 47th at-bat.

Triggs (5-3) allowed six runs (five earned) and eight hits in 5 1/3 innings as his ERA went from 2.12 to 2.77. He struck out seven and walked three.

The A’s committed three errors, and they lead the majors with 42.

“Coming in here, you say give us three out of four to them and you’ll take it,” A’s manager Bob Melvin said of winning the series against Boston. “Granted, once you win three games, you want to get greedy and win the last game. You know, it felt like we had them on the run a little bit.”

The Red Sox scored twice in the top of the first. Mookie Betts led off with a walk. He scored when Pedroia blooped a single and right fielder Mark Canha threw wildly to second for an error. Pedroia advanced to third on a wild pitch and scored on Andrew Benintendi’s sacrifice fly.

“We were timely, we were aggressive, and we made it pay off,” Red Sox manager John Farrell said. “Mitch’s two-run homer really allowed us to spread things open a little bit, and all the while here’s Eddie just maintaining the rhythm on the mound.”

Oakland cut Boston’s lead to 2-1 in the second when Pinder lined a two-out double to left-center field and scored on Josh Phegley’s single to center.

Then in the fourth, Pinder hit a two-run shot to left, his fifth home run of the season, putting Oakland ahead 3-2.

Boston answered with two runs in the fifth to retake the lead at 4-3.

“The inning I’m most frustrated with is after Pinder gave us that two-run home run that gave us the lead and then I gave it right back there in the fifth,” Triggs said. “For the most part, I felt like I made some decent pitches, but I didn’t do enough to really slam the door shut that inning, and they made me pay for it.”

NOTES: The Red Sox recalled RHP Brandon Workman from Triple-A Pawtucket and optioned RHP Noe Ramirez to Pawtucket. … A’s LHP Sean Doolittle (strained left shoulder) threw off a mound for the first time since going on the disabled list April 30. He worked off flat ground and then threw 15 pitches in the bullpen. He will throw a 25-pitch bullpen session Wednesday. … Oakland 1B Yonder Alonso (strained left knee) was out of the starting lineup for the fourth straight game. He was available off the bench but did not get into the game.