BALTIMORE — Batting in the eighth inning of a tie game, Brock Holt wasn’t trying to emulate teammate David Ortiz.

It just turned out that way.

Holt hit a tiebreaking, three-run homer off Darren O’Day, and the Boston Red Sox beat Baltimore 7-5 Friday night to extend the Orioles’ losing streak to five games.

Ortiz also connected with two runners on, and Hanley Ramirez added a solo shot for the Red Sox, who have won three of five this season against the defending AL East champions.

Ortiz is known for hitting long balls. Holt is not. The 5-foot-10, 180-pound Holt has five home runs in 606 career at-bats and hadn’t gone deep since Sept. 4, but he broke open a 4-all game with a drive over the right-field scoreboard.

“It was just the same approach that I normally have – trying to get a good pitch to hit and hitting it hard somewhere,” Holt said. “He just left the fastball up and over the plate, and fortunately I was able to hit it out.”

Jimmy Paredes and Chris Davis homered for the last-place Orioles, whose skid is their longest since September 2013.

“We’ve got to grind through it,” Manager Buck Showalter said.

After Tommy Hunter retired the first two Boston batters in the eighth, Brian Matusz (0-2) walked Pablo Sandoval. Pinch-hitter Allen Craig followed with a sharp bouncer off O’Day that skipped past third baseman Manny Machado, who was charged with an error.

“Manny’s as good a third baseman as you can find,” Showalter said. “He’s bailed us out a lot of times.”

Holt then brought home three unearned runs with his homer.

Alexi Ogando (1-0) struck out Machado with two outs and the bases loaded in the seventh after Everth Cabrera hit a tying sacrifice fly.

Junichi Tazawa gave up a solo shot to Davis in the eighth, but Koji Uehara worked the ninth for his third save.

Miguel Gonzalez allowed four runs and eight hits in six innings for Baltimore. It was only the fifth time in his last 30 starts that the right-hander yielded as many as four earned runs.

Boston starter Rick Porcello gave up four runs and six hits in six-plus innings. In his previous outing, also against Baltimore, the right-hander allowed eight runs and a career-high 12 hits.

Porcello struck out the first five batters and didn’t give up a hit until Machado singled with one out in the fourth. Paredes followed with a shot to right for a 2-0 lead.

The advantage didn’t last long.

Gonzalez retired the first two batters in the fifth before Mookie Betts walked and Dustin Pedroia singled to set the stage for Boston’s first back-to-back homers of the season. Ortiz hit a three-run drive to right that barely cleared the outstretched glove of a leaping Delmon Young, and Ramirez crushed a no-doubt shot to left.

Baltimore got a run back in the bottom half when Rey Navarro doubled and scored on a single by Cabrera.