BOSTON -- With his team going deep into another extra-inning game at Fenway Park, Orioles manager Buck Showalter scanned the dugout and saw first baseman Chris Davis. His mind immediately went back to that 17-inning game in 2012 when he was forced to call on Davis to pitch the club to victory.

“I had some deja vu going,” Showalter said. “I’m going, ‘Come on.’”

That victory over the Boston Red Sox was a landmark win, and in some ways, it began the Orioles’ recent streak of success in Boston. It also fueled the team’s resurgence to its current place among the heavyweights of the American League East.

And Sunday’s 7-6 victory over the Red Sox in 12 innings might end up being just as important for this year’s Orioles, who managed to survive a 5-hour, 5-minute marathon with a series win and their 18th victory in their last 27 games at Fenway Park.

Winning two of three games this weekend wasn’t easy for the Orioles — the teams played 30 innings in three games over the past two days.

Showalter ultimately didn’t need to call on Davis. Instead, right-handed reliever Brad Brach was the unsung hero, pitching three scoreless innings in a tied game and keeping the Boston hitters at bay until the Orioles offense could rally.

And that happened in the top of the 12th, when left fielder David Lough — who entered in the bottom of the seventh as a defensive replacement — opened the inning with a stand-up triple off Red Sox right-hander Edward Mujica. Shortstop J.J. Hardy immediately followed with a run-scoring single to left field past a drawn-in infield to score Lough.

Left-hander Zach Britton closed the door on the Red Sox (39-49) in the bottom of the 12th for his 14th save in 16 opportunities.

“That’s the kind of game that good teams win,” Showalter said. “I was thinking that in the dugout. It’s so easy just to say, ‘Boy, it wasn’t meant to be today,’ instead of making it happen.”

With the win, the Orioles (48-40) are a season-high eight games above .500. And this is the first time they have led the AL East by two games or more since May 22, 2012.

“Awesome, especially [with] playing 30 innings in two days,” Brach said. “To come out with two wins [in the series] is huge. It would have been a tough one if we hadn’t won today. So, it was great going out there and helping us get a win. It was a great weekend.”

The Orioles have won six of their last seven games overall and are now 24-17 against divisional opponents this year.

Brach (4-0) allowed just two base runners — one hit and one walk — in three shutout innings. He struck out four batters and threw 45 pitches one day after he pitched 1 1/3 scoreless innings in their 7-4 doubleheader nightcap win Saturday when starter Ubaldo Jimenez lasted just 3 2/3 innings.

Brach has earned the win in four of his last seven appearances and has thrown 12 straight scoreless innings in that span. He quieted the Red Sox offensively after they rallied from a 6-1 deficit with a five-run seventh inning.

“I was kidding him after the game. I said, ‘You are going to keep messing around here and present yourself as a starter,’ ” Showalter said of Brach. “Brad has got a really good makeup. He is not scared. He is the kind of guy you like.”

After the game, Showalter said the only reliever still available in the bullpen after Brach was Britton. And he was being saved to close out the game with a lead, so the game was in Brach’s hands as long as it remained tied.

“I pretty much knew I had to go out there — whether it was going to be three, four or five innings — and just put up zeroes,” Brach said. “I wasn’t worried about who was going to be able to pitch, just more put up zeroes and give us a chance to win.”

That chance came when Lough lined a 1-0 pitch from Mujica (2-4) to center field that rolled all the way to the wall.

For Lough, who entered the day hitting just .191, it was his first extra-base hit in nearly a month — he homered against the Oakland Athletics on June 7.

Lough also made a game-saving play in the bottom of the 12th when David Ortiz slapped a hit down the left-field line that one-hopped off the Green Monster. Lough played the carom perfectly and threw Ortiz — the possible tying run — out at second base as he tried to extend the hit into a double.