After Murphy's extra-base hit off the just-reinstated Brian Matusz snapped a 3-3 tie in the fifth inning, three New York relievers combined for 4 1/3 hitless frames to enable the Yankees to halt a three-game skid and avoid a series sweep from their AL East rivals.
Chasen Shreve (3-1) was credited with the win after retiring all four batters he faced after taking over for Adam Warren, who struck out five in 4 2/3 innings but was reached for three runs.
Mark Teixeira added an RBI double for New York.
The Orioles had a season-high seven-game win streak end after starter Mike Wright (2-2) was tagged for five runs in only four-plus innings of work.
Baltimore finished with just six hits, including a two-run single from Nolan Reimold and an RBI double from Caleb Joseph.
Wright was operating with a 3-2 lead when the rookie walked Chase Headley, Alex Rodriguez and Teixeira in succession to begin the fifth. Matusz, back from serving an eight-game suspension for being caught with a foreign substance on his arm, then entered in relief and issued a free pass to Garrett Jones that forced in the tying run.
Matusz briefly bounced back to strike out Stephen Drew and Didi Gregorius, but Murphy sent a hard grounder past a diving Manny Machado and down the left- field line that put New York up by a 5-3 count.
Shreve entered with two on and two out in the bottom of the fifth and got Travis Snider to lift a fly ball to left that Brett Gardner hauled in on the run, then retired the side in order in the sixth to keep the two-run lead intact.
Justin Wilson followed with two perfect innings, while Dellin Betances fanned pinch-hitter Matt Weiters with Machado on second in the ninth to earn his third save.
Teixeira's two-out double into the left-field corner plated Gardner in the opening inning to stake Warren to a 1-0 edge, but Baltimore answered with a pair of runs in its half of the frame.
Wright found himself back in trouble in the second, though, as the Yankees loaded the bases with none out on three straight singles. The young righty was able to limit the damage to one run, with Gregorius just beating Adam Jones' throw home on Gardner's flyout to center that tied the game at 2-2.
Warren's leadoff walk to Reimold in the fourth helped the Orioles move back in front when Joseph came through with a bloop double to right with two out.