BOSTON — With one out remaining in the bottom of the fifth inning, Boston’s Rick Porcello had allowed three hits, the Pirates’ Gerrit Cole one.

“Both guys were throwing a heck of a game,” Boston Manager John Farrell said.

It only took five batters to change that, as the Red Sox got to Cole and ended up with a 5-3 win on Opening Day Monday afternoon before a capacity crowd of 36,594 at Fenway Park in their first game since David Ortiz’s retirement.

Now, back to that fifth inning, with two outs:

 Jackie Bradley tripled.

 Pablo Sandoval beat out an infield single to score Bradley. (Yes, you read that right; the slimmed-down Panda got it in gear).

 Catcher Sandy Leon singled – on a bunt.

 Dustin Pedroia singled in Sandoval from second … yes, from second base.

 Andrew Benintendi capped the rally with a three-run homer and a 5-0 lead.

Porcello, who won his first Opening Day start, allowed three runs on six hits over 61/3 innings.

Cole was working on a one-hitter after he retired the first two batters in the fifth.

“They were matching pitch for pitch,” Farrell said.

Well, not exactly. Cole was cranking up his fastball to 97, 98 and 99 mph. Porcello’s fastball dipped below 90 mph in the later innings, but he mixed in his slider and curve. He walked one and struck out five.

“He stayed ahead in the count with everything,” Leon said.

Porcello was backed with some good defense, including Bradley’s hustle into the triangle to catch a fly ball just before he pushed off the wall.

“I’ve seen so much from him I feel like it’s routine,” said Benintendi, who made his own stellar catch in left field in the seventh.

But could Boston’s bats back up Porcello?

Bradley woke up Fenway with his triple off the right-field wall. Sandoval’s grounder was to the shortstop-third base hole. The throw to first was high, but Sandoval had it beat anyway.

Leon came up and the Pirates went into a shift toward the right side. Leon, the No. 9 batter, had one thought.

“We got Petey and Benintendi coming up. Just get on base for those guys,” said Leon, who pushed a bunt down the third-base line for an easy single.

Pedroia’s single scored Sandoval for a 2-0 lead. Then Benintendi, the player who rose from Class A ball, through Double-A Portland to Boston last year, faced a 2-2 count. He crushed a 98 mph fastball into the Pirates’ bullpen in right field.

“We’re able to bunch a number of two-out base hits together – with Benny getting the big blow,” Farrell said.

Cole, who needed only 50 pitches for the first four innings, threw 26 in the fifth and was done for the day.

Porcello lost his shutout in the seventh. He gave up three hits, including Josh Harrison’s RBI single, and left the game with one out and a 5-1 lead.

“I’m satisfied with the win,” said Porcello.

Matt Barnes relieved and allowed both inherited runners to score on an RBI single (Jordy Mercer), walk and sacrifice fly (Starling Marte).

The sacrifice fly was actually a line drive toward left-center that Benintendi made a leaping catch on.

Relievers Robby Scott and Heath Hembree took care of a 1-2-3 eighth.

Closer Craig Kimbrel allowed a leadoff double in the ninth. After two strikeouts, he hit a batter, before getting Marte to pop out for his first save.

The Red Sox and Pirates are off Tuesday and resume the series at 7:10 p.m. Wednesday in Chris Sale’s Boston debut.

Kevin Thomas can be reached at 791-6411 or:

[email protected]

Twitter: @ClearTheBases