BALTIMORE — The Baltimore Orioles didn’t waste any time scoring against Rick Porcello.

It’s a good thing, too, because the 2016 AL Cy Young Award winner got a whole lot sharper as the game wore on.

Seth Smith and Manny Machado hit first-inning home runs to back a redemptive pitching performance by Alec Asher and help Baltimore beat the Boston Red Sox 3-2 Friday night.

Jonathan Schoop had two hits and scored a run for the Orioles, who have won 4 of 5 following a seven-game losing streak.

After hitting four home runs in the series opener Thursday, the Orioles used the long ball to take control against Porcello (3-7). Smith drove a 3-2 pitch into the right-field seats for his third career leadoff homer, and Machado pulled a fastball into the second deck to make it 2-0.

Baltimore never relinquished the lead.

“Against guys like Porcello, if you get a little pop at them early you’d better take advantage of it because they’re going to settle in,” Orioles Manager Buck Showalter said.

Porcello allowed just one more run over the next five innings before departing.

“I felt better as the game went on, but it’s definitely not the way you want to start a ballgame,” Porcello said. “That kind of set the tone.”

Asher, in contrast, retired 16 of the first 17 batters and ended up allowing two runs and three hits over 61/3 innings. It was his second start since replacing Ubaldo Jimenez in the Baltimore rotation; in his first try, Asher (2-3) yielded six runs over two innings in loss to Houston on Sunday.

“It’s nice to rebound and have a good game,” he said. “But winning the game, that’s the No. 1 goal.”

Brad Brach, the third Baltimore reliever, got three straight outs for his 11th save in 14 tries.

Pablo Sandoval homered for the Red Sox, 4-7 against the Orioles after losing two straight in this four-game series between AL East foes.

“Give credit to Asher,” Manager John Farrell said.

Porcello went 22-4 last year but this season has allowed at least eight hits in seven of 12 starts – including each of the last five.

“I thought as the game went along he got much better,” Farrell said. “He’s a little snake-bit right now, to be honest.”

After Sandoval hit a solo shot in the third inning, Schoop singled and scored on a double by Hyun Soo Kim in the fourth.

The Red Sox chased Asher and closed to 3-2 in the seventh. Xander Bogaerts hit a leadoff double and Jackie Bradley delivered a two-out RBI single off Mychal Givens.

NOTES: Boston RF Mookie Betts went 0 for 4 to remain three hits short of 500, but he made a sensational diving catch of a sinking liner hit by Adam Jones in the seventh inning.