BOSTON — Facing one of the hottest pitchers in the majors, the Boston Red Sox got to Cleveland’s Danny Salazar early and beat the Indians 5-2 Sunday afternoon, before 36,021 at Fenway Park.

The win moved the Red Sox (27-17) back to within a few percentage points of Baltimore (26-16) in the American League East standings.

David Ortiz continued to make his farewell season memorable with a home run, two doubles, a single and three RBI. The homer was Ortiz’s 11th this season and the 514th of his career.

Jackie Bradley Jr. singled in the fifth inning to extend his hitting streak to 27 games, tied for sixth all-time in Red Sox history.

Rick Porcello (7-2) got the win, going 52/3 innings, allowing two runs on five hits. He retired 12 of the last 14 batters he faced.

Five relievers followed Porcello, finished by Craig Kimbrel’s 1-2-3 ninth for his 12th save.

Salazar (4-3) entered with a 1.80 ERA, but Boston knocked him out in the fifth inning, totaling eight hits and four runs off the Cleveland right-hander.

Salazar needed 40 pitches to finish the first inning and was at 69 pitches after the second.

“We were able to take some pitches,” said leadoff batter Mookie Betts. “Even when he threw strikes, we were kind of patiently aggressive … He was struggling early and that was our time to get to him.”

Betts, who went 2 for 5, grounded out to begin the first inning, but Salazar’s trouble began with the next batter. Dustin Pedroia worked a nine-pitch walk.

Xander Bogaerts followed with a single to left. Ortiz singled to right to score Pedroia. Ramirez followed with an infield hit off Salazar’s foot, driving in Bogaerts for a 2-0 lead.

Porcello gave up the lead in the second inning when Jason Kipnis capped a two-out rally with a two-run bloop single.

But Boston got the lead back for good in the bottom half. Singles by Betts and Bogaerts set up Ortiz’s RBI double.

“They take some pretty good swings,” Indians Manager Terry Francona said of his former team.

Ortiz made it 4-2 in the fifth, clearing the Indians’ bullpen after a Salazar fastball. Salazar exited following Bradley’s one-out single.

“We got it rolling today, put some runs on the board, and Rick took care of the rest,” Bradley said.

Porcello pitched out of a jam in the first, with runners on first and third with one out. In the second, he got two quick outs before loading the bases on a double, a hit batter and a walk. Kipnis followed with his single.

Porcello allowed only two more baserunners.

“Just settling in and calming down,” Porcello said. “I was overthrowing and (got) of out of my game a little bit … so I just tried to get the ball down and get some quick outs.”

Boston got its final run in the sixth. Betts doubled and scored on Bogaerts’ bloop single.

NOTES: Porcello’s seven wins are second in the American League to Chris Sale’s nine. His ERA dropped to 3.47 … Bradley’s hitting streak is tied with Ortiz, Manny Ramirez and Dom DiMaggio on the team’s all-time list. Next up is Wade Boggs in fifth place at 28 games. DiMaggio also had a 34-game streak, the best in Boston history. … Bogaerts has a 16-game hitting streak. …

Ortiz is seven home runs away from a 19th-place tie on the all-time list, with Will McCovey, Frank Thomas and Ted Williams. … In his last 10 appearances, Kimbrel was held opponents to a .034 average (1 for 29).