BALTIMORE -- The Baltimore Orioles will see if Friday night's stirring come-from-behind win has any carryover effect when they host the Arizona Diamondbacks on Saturday night at Camden Yards.

Trailing 2-0 after two innings, the Orioles tied it with solo homers by Pedro Alvarez and Matt Wieters in the eighth and ninth innings, respectively, and won it when Mark Trumbo hit his 44th homer of the season leading off the 12th.

The win snapped a four-game losing streak and allowed them to remain a half-game behind Toronto and Detroit.

More from FoxSports

"Momentum is your next game, it really is," manager Buck Showalter said afterward. "I'm glad our guys feel good about themselves for one night, they've been frustrated."

Trumbo was asked if Friday's win takes some pressure off a team that had just been swept by Boston.

"That's the million-dollar question. I hope so," he said. "We're giving it everything we have and obviously we have to keep it going. We know what we have to do, and we've got the guys to do it."

Saturday's game matches a pair of 8-13 pitchers, and the starter for Baltimore will be left-hander Wade Miley (8-13, 5.65 ERA), who will make his first career start against the team that drafted him.

Miley was the taken by the Diamondbacks with the 43rd overall pick in the 2008 draft and won 16 games for Arizona in 2012, his first full season.

Since joining the Orioles in trade with Seattle on July 31, Miley is 1-5 with a 7.60 ERA. He allowed one single over four shutout innings in his last start, but left with a muscle strain in his upper back before the fifth.

The Orioles (83-71) won despite stranding 14 baserunners, relying on the long ball.

"That's what they're known for," said reliever Matt Koch, who gave up Trumbo's game-winner when his fastball caught too much of the plate. "If you make mistakes, they'll make you pay."

The Diamondbacks (64-89) have lost three of four.

Arizona's starter on Saturday will be left-hander Robbie Ray (8-13, 4.66), who will face the Orioles for the first time. In his last four road starts he is 1-1 with a 3.33 ERA, 31 strikeouts in 24 1/3 innings, and has held opponents to a .163 batting average. In seven career road interleague starts, he is 2-3 with a 3.64 ERA.

He is second in the majors (behind Jose Fernandez of the Marlins) with 11.39 strikeouts per nine innings pitched.

Arizona left fielder Brandon Drury has reached base safely in 16 of his last 19 games, batting .370/.439/.644 with five homers and 14 RBIs in that span.

Second baseman Jean Segura drove in one of the Diamondbacks' runs Friday night with a double and is hitting .409/.458/.818 with five homers and nine RBIs over his last 10 games.

Segura extended Friday night's game with a fine defensive play, backing up first base on a bunt attempt and corralling an errant throw.

"(Baltimore) did a great job of battling back and tying the game and we did a great job of stopping them from winning the game a couple of times," Arizona manager Chip Hale said. "We had some great plays."