NEW YORK -- For the second time in three days, the Orioles and Yankees went to extra innings. And Baltimore again showed its grit.Backed by some stellar relief outings and a 16-hit output to cover up Mike Wright Jr.'s short start, Craig Gentry's two-out, 12th-inning RBI single put the O's

NEW YORK -- For the second time in three days, the Orioles and Yankees went to extra innings. And Baltimore again showed its grit.

Backed by some stellar relief outings and a 16-hit output to cover up Mike Wright Jr.'s short start, Craig Gentry 's two-out, 12th-inning RBI single put the O's on top for good, 8-7, over the Yankees. The victory marked the Orioles' third in four games in the Bronx --more than they had total all of last year-- giving them their first series "W" and plenty of momentum as they head home.

"It's been extremely eventful, that's for sure," reliever Richard Bleier said of the 44 innings played in the Bronx over the series. "But really a great series for us. Things weren't looking that great against Houston -- we got swept -- and then coming in here, a place where we historically don't play well, to take three of four is really impressive. I think it's a good turnaround."

Like Friday's 14-inning marathon, there were plenty of other key performances that made Gentry's single off Adam Warren possible. Closer Brad Brach got out of a bases-loaded jam in the 12th, Bleier threw three scoreless innings of relief and Rule 5 Draft pick Pedro Araujo tossed 2 1/3 scoreless after Wright to allow the offense some time to work.

After the Yankees put runners on the corners on Tanner Scott in the seventh inning, manager Buck Showalter called for reliever Darren O'Day , who gave up a game-tying, two-out RBI single to Austin Romine . O'Day then got pinch-hitter Didi Gregorius to pop up to end the inning.

Rule 5 Draft pick Anthony Santander hit his first career home run, which came with two outs in the seventh inning and gave Baltimore a temporary 7-6 lead. Manny Machado also came through in the sixth to bring the O's within a run. Danny Valencia clubbed his first homer of the season, a two-run blast in the top of the fifth inning that ended Yanks starter Jordan Montgomery 's day.

"These guys just don't give in. It goes back to Araujo and the outing he had," Showalter said. "I think he kind of made everybody think, 'OK, we might just have a chance to hold them there.' But two short outings and the extra-inning games really challenged, and guys responded."

All of the offense helped overcome a disappointing outing by Wright. The righty was chased two outs into the game after allowing five runs (two earned) in what may have been his last start. With Alex Cobb's expected arrival later this week, the Orioles will have to make a roster move and free up a rotation spot. Wright, who put the O's in a 5-0 deficit before the second inning, seems to be the most logical choice.

"I felt like I was throwing some pretty good pitches. They're a good-hitting team. They made some quality contact," said Wright. "I think the one pitch I really, really wish I had back was the last one to [Ronald] Torreyes. But other than that, I feel like I battled and threw some pretty good pitches."

MOMENTS THAT MATTERED

Brach bends, doesn't break: Brach issued a pair of walks and then flubbed the sacrifice bunt by Brett Gardner back to the mound to load the bases and bring up Aaron Judge . But Judge grounded back to the mound for a double-play ball, and Brach struck out Giancarlo Stanton to end the game.

"I just told Brach if he gets a comebacker to come to me. That's obviously the play we're going to," catcher Caleb Joseph said of Judge's ball. "I was thinking if there was a chance, let's try for third here. As soon as I received the ball, [Tim] Beckham was right at third base. I didn't hesitate, didn't think twice about it, threw the ball to third.

"It's a play I've thought about plenty of times before, because most catchers will throw the ball to third base. You have two outs, that sounds great, but you also have the winning run at second base, so a flare not only ties the game, but it beats you, and I've always wondered why guys didn't try to go to third base there to try and keep the winning run at first base so that it takes an extra-base hit to beat you, so it worked out. We're really excited about it. We're really proud of Brach for really grinding that one out, getting the big 'W' for us."

Yankees on the Wright side: New York sent 10 men to the plate in the first inning, chasing Wright from the game after recording just two outs. One of the biggest momentum swings was Neil Walker 's tapper back to the mound, which Wright -- instead of going home -- turned and fired wide to second base.

Gentry vs. Warren: An 11-pitch at-bat, during which it looked at one point like the Yanks' reliever may have gotten Gentry to strike out, culminated with him instead lacing a ball into left field. Gentry also made a difference with his glove, making a diving grab with a man on second in the 10th.

"I played in because I was protecting against their speed at second base in case we had to try to throw him out," Gentry said. "But he hit it over my head, and it was slicing, and to be honest with you, there was a little bit of panic there. But I was able to get back on it, and get my head turned around quickly enough to make the play."

QUOTABLE

"We showed what type of team we are this series. We played two long ones and just fought the whole time. We were in a big hole today and kept fighting, and it just shows a lot of character on the team." -- Gentry

"Every time I receive the opportunity, I'm very thankful for that, to take advantage of the whole situation. Hopefully, there are more opportunities for me coming soon so that I can help the team." -- Santander, through an interpreter, on his first homer

SOUND SMART WITH YOUR FRIENDS

The Yankees and Orioles played 14 innings Friday night (with the O's winning, 7-3) before Sunday's marathon. It was the first Yankees home series with two games that went at least 12 innings since July 6-7, 1990, against the Twins. In that series, the Yankees lost a 2-0, 12-inning first game of a doubleheader, then won, 5-4, in 12 the following day.

MITEL REPLAY OF THE DAY

The Yankees got a break in the bottom of the fifth inning, extending the frame on a two-out call that was overturned. Jace Peterson was ruled safe at first base after 51 seconds of review, beating out an infield hit to Machado. The call brought Romine to the plate, and Romine singled off Miguel Castro down the right-field line to score another run and increase New York's lead to two.

WHAT'S NEXT

The Orioles will head home to open a three-game series against Toronto with Dylan Bundy on the mound on Monday. Baltimore's most dependable starter, Bundy has allowed just one earned run over his first 13 innings this season. The righty has struck out 15 and walked three over that stretch.

Watch every out-of-market regular-season game live on MLB.TV.

Brittany Ghiroli has covered the Orioles for MLB.com since 2010. Follow her on Facebook and Twitter @britt_ghiroli, and listen to her podcast.