"My teammates made me look good," said Ryan, who greeted O's closer Jim Johnson with a line drive to right field and advanced to third base on a pair of bunts. "You don't win a game on a bases-empty single. That's just good fundamental baseball. It's winning baseball."
Mark Reynolds and Curtis Granderson homered for the Yankees, who remained one game behind the Rays in the chase for the second American League Wild Card spot with 15 games remaining. Tampa Bay defeated the Red Sox, 4-3, at Tropicana Field.
"It's important. We need to continue to win and we need to continue to take series if we want to play in October," Yankees manager Joe Girardi said. "We got a lot of good performances out of people tonight."
Though he protected a one-run lead in the ninth inning, Mariano Rivera was credited with the victory -- not a save -- due to the discretion of the official scorer, who invoked Rule 10.17 (c) to state that David Robertson had been "ineffective and brief" in his eighth-inning appearance.
Rivera continues to hold true to his promise of emptying the tank, appearing for the fourth time in five games, but insisting that there is no reason to hold anything back.
"There's no time to look back or sit around. We're fighting for something," Rivera said. "As long as we're OK, we have to continue."
Robertson allowed four hits in the eighth, including Danny Valencia's game-tying three-run homer, to flush a 5-2 lead.
"I battled, but I just didn't make enough good pitches," Robertson said. "I left too many pitches in the middle of the plate, and those guys made me pay for it."
But Johnson offered a wild throw and a wild pitch in the ninth, firing a Chris Stewart bunt into center field that allowed Ryan to reach second base. Granderson dropped a sacrifice to advance Ryan to third. When Johnson bounced a pitch to Alex Rodriguez that scooted past catcher Matt Wieters, Ryan -- who was acquired from the Mariners late Tuesday night to help fill in for the injured Derek Jeter -- was on the move again.
"Jimmy's one of our best fielding pitchers," Orioles manager Buck Showalter said. "Nobody works harder at it than him. He just couldn't quite get a good grip on it."
Earlier, Reynolds slugged a two-run blast for his 200th career homer, and Granderson reached Eutaw Street beyond the right-field wall for the second time in two games.
Vernon Wells also stroked a two-run single to lead the charge against Baltimore starter Wei-Yin Chen, who allowed five runs in 6 1/3 innings.
Girardi gambled with what turned out to be a tandem start of right-hander Phil Hughes and left-hander David Huff, squeezing a combined six innings of two-run, five-hit ball from the hurlers.
"After having not pitched a lot in the last couple of weeks, command was my biggest concern," Hughes said. "It was pretty good. I didn't walk anybody and I was throwing a lot of strikes, so I was happy with that."
Hughes allowed a run on three hits over three-plus innings, giving up a third-inning Manny Machado RBI single in a 50-pitch start. Huff relieved and limited the Orioles to Nick Markakis' seventh-inning solo homer, scattering just two hits.
"We had a comfortable lead. I didn't want to go in there and start nibbling or being too fine," Huff said.
New York put up four runs through the first three innings against Chen, but the left-hander settled in to retire 13 straight before being chased by Granderson's seventh-inning homer, the sixth of the slugger's abbreviated season.
Girardi pieced together the bullpen to get to the late innings, using Adam Warren for two outs and Cesar Cabral for an out. A terrific leaping catch by left fielder Alfonso Soriano took away a Machado homer leading off the eighth, an indication that Robertson's outing might not go smoothly.
"That's the first homer that I stole from somebody," Soriano said, beaming. "I'm very excited because it was a close game and a very important catch, and very important for me."
The Yankees could exhale after Rivera's appearance, his final regular-season one at Camden Yards. But the retiring all-time saves leader acknowledged that this late-season push -- necessary as it may be -- is taking its toll in more ways than one.
"Obviously you're going to feel some bumps and bruises. It's not like I'm Superman or something like that," Rivera said. "At the same time, it's something that you can handle, something you can pitch with. As long as it feels like that, it'll be OK."