BOSTON — One night after being embarrassed in the series opener, Baltimore overpowered Boston this time and preserved the jumble of teams contending for the AL East.

J.J. Hardy hit a three-run homer and Nolan Reimold added a two-run shot later in the second as Baltimore beat Boston 6-3 Tuesday night and pulled within two games of the division-leading Red Sox.

Jonathan Schoop added a solo homer in the ninth for the Orioles, who evened the series after getting rocked 12-2 Monday in the opener. With Toronto’s 6-2 loss to Tampa Bay, the Orioles pulled even with the Blue Jays for second in the division and tied for the two AL wild-card berths.

“We get a chance to win another series on the road, which is something we knew we were going to have to do,” manager Buck Showalter said.

Orioles rookie Dylan Bundy (9-5) survived a rocky second inning and pitched into the sixth, holding Boston to three runs on six hits over 5 1/3 innings.

“The second inning was probably one of the keys to the game,” Showalter said. “He didn’t let it get away from him.”

Zach Britton pitched a scoreless ninth for his 42nd save.

Xander Bogaerts homered for Boston, which had won five of six and missed a chance to gain a little space in the crowded field of division leaders with just 18 games remaining.

The Red Sox had as many hits as the Orioles, both finishing with nine, but Boston was woeful with runners on base. The Red Sox were 1 for 10 with runners in scoring position and left nine runners on base.

“Five runs in Fenway Park is nothing. We didn’t think that was going to be enough to win tonight,” said Travis Shaw, who was 3 for 4 and scored a run for Boston. “Unfortunately offensively, there was a couple times we had guys in scoring position and we just didn’t come up with the hits.”

Drew Pomeranz (10-12) gave up five runs and four hits in two-plus innings, his shortest outing of the season. He continued to struggle since a July trade from San Diego, falling to 2-5 with Boston.

Pomeranz was pulled with nobody out in the third after Manny Machado’s leadoff single to left. After needing just 11 pitches to set down the Orioles in order in the first, Pomeranz labored through 45 pitches in the second.

“The lack of consistent command was the difference in this one,” Boston manager John Farrell said.

Mark Trumbo led off the second with a single and Chris Davis walked, then with one out Hardy broke the scoreless tie with a towering homer that bounced off one of the signs above the Green Monster in left field. The Orioles weren’t done yet with Pomeranz, who walked Drew Stubbs after Hardy’s homer and Reimold followed with a line drive homer to left.

“I just got in some tight spots and didn’t make pitches when I needed to. That’s about how it went,” Pomeranz said. “It’s pretty frustrating. I was trying to get in on some of those guys and the ball was just shooting back over toward the middle of the plate.”

Bundy unraveled slightly in the bottom of the second, walking Ryan Hanigan and Dustin Pedroia with the bases loaded for Boston’s first two runs. Despite walking three and allowing two hits during the inning, Bundy limited the damage to just the pair of runs.

Boston didn’t score again until Bogaerts led off the fifth with his 19th homer of the season, pulling the Red Sox within 5-3.

The three-game series wraps up Wednesday. The Red Sox and Orioles meet again next week for four games in Baltimore.

LONG TIME

Reimold went 2 for 3 for his first multi-hit game since July 2. He hadn’t driven in a run since getting a pair of RBIs against Cleveland on July 24.

“It definitely feels good. I was glad I was able to do it and do something positive and come away with the win,” Reimold said.

ROOKIE WINS

Bundy wasn’t happy when Showalter pulled him in the sixth, but admitted listening to the skipper is one of the many things he’s picking up on in his first season in the big leagues.

“It’s all new territory. I haven’t pitched this far into September before and I haven’t pitched at this level for this long, so I’m just trying to learn as much as I can every day and get better every day also.”

TRAINER’S ROOM

Orioles: OF Steve Pearce was not in the starting lineup will have his right elbow examined for a nagging injury that he aggravated making a throw from left field Monday night.

Red Sox: Activated rookie OF Andrew Benintendi from the 15-day DL. Benintendi had been on the DL since Aug. 25 with a sprained left knee.

UP NEXT

Orioles: RHP Kevin Gausman (7-10, 3.61) starts for the Orioles in the series finale and Baltimore’s last game at Fenway Park this season.

Red Sox: RHP Rick Porcello (20-3, 3.21) already leads the majors in victories and is unbeaten in home starts.