BALTIMORE -- On a night when he walked to the mound fearing the worst, Phil Hughes was somewhat gratified to look up after recording 17 Orioles batters and see the damage had been limited to just a run on two hits.

That pretty line score wouldn't last. After Hughes used up the last of his 109 pitches in a gritty effort, the struggling Orioles surged for a three-run sixth inning and withstood a ninth-inning rally to post a 5-4 victory over the Yankees -- Baltimore's first win this season at Camden Yards.

"It doesn't really make a difference what their record is, because they usually get up for us," said Yankees shortstop Derek Jeter. "You can't really concern yourself with what a team's record is. We know they have a good team. They're capable of scoring some runs."

Losing pitcher Dave Robertson inherited a runner -- a walk issued by Boone Logan -- in that sixth inning and got ahead of Ty Wigginton with two strikes before drilling the Baltimore second baseman in the ribcage, putting the go-ahead run on base.

The Orioles, owners of just three victories entering play Tuesday, wouldn't let the opportunity pass. Rhyne Hughes stroked a run-scoring single to right field to bring home Luke Scott with the tying run, a ball Randy Winn slipped on as he was feeding back to the infield.

"It seemed to fall apart after that. They got three runs with nobody on and two outs," Yankees manager Joe Girardi said. "It's something that shouldn't happen, but it's the human element. We couldn't get that third out."

Nolan Reimold gave the Orioles the lead with another hit, and Cesar Izturis -- on his way to a three-RBI evening -- capped the frame with a single to center, chasing around the fourth Baltimore run of the night.

"It's a big league lineup. They can hit," Robertson said. "They're here for a reason. I don't think it really matters -- anyone anywhere can get you at any time, and I threw some pretty good balls in the zone."

The Yankees would put up two runs in the ninth off Alfredo Simon, making his season debut, which made a Jeter error in the eighth all the more glaring.

After Jeter booted Wigginton's grounder, pinch-runner Julio Lugo stole second base and advanced to third on catcher Jorge Posada's throwing error, and Izturis knocked in the run with a single.

"It always hurts anytime you make an error and the guy ends up scoring," Jeter said. "Obviously it doesn't feel good. I stayed down and it hopped up and hit me in my bicep. I wish it didn't, but I guess that's part of the game."

The bullpen troubles came after Hughes had to fight through five frames, dodging damage on an evening that appeared as though it might end much earlier -- Girardi had long reliever Sergio Mitre warming up in the second inning.

"He battled, because he was not on top of his game today, and he shut them down for the most part," Girardi said.

One start after Hughes had carried a no-hitter into the eighth inning at Oakland, the Orioles appeared poised to make quick work of the righty in the second inning.

Hughes would later say that he knew that start in Oakland was going to go well because he'd felt awful warming up. When the opposite transpired on Tuesday, hitting every spot in the bullpen, he feared he was going to have to work for it.

"If one thing picked up, it seemed like another thing fell off," Hughes said. "I really had no feel of anything tonight. I was trying to get it going, but I couldn't get my fastball where I wanted it to. I didn't feel great out there."

In the Baltimore second, Scott singled, moved up on a hit and walk, and then scored on a bases-loaded walk to Izturis. Apparently on the ropes, Hughes got Adam Jones to roll over on a key double-play ball and finished holding Baltimore into the sixth.

"I would say he labored more than just a little bit," Girardi said. "He had a hard time getting ahead in the count. He threw a lot of balls tonight and was able to fight his way through it. He got a big double play in the second inning when they had an opportunity, and he fought his way through it."

Brett Gardner's hot ground ball ate up third baseman Miguel Tejada for an error as Nick Swisher scored the Yankees' first run in the third inning, and Posada belted a solo homer -- his fifth -- off Kevin Millwood in the fourth.

The Yankees did have their last gasp in the ninth, as Swisher logged a one-out hit and pinch-hitter Nick Johnson came off the bench guarding a stiff lower back and played to his M.O., working a walk.

Izturis booted a Gardner grounder that scored Swisher, and Mark Teixeira stroked a run-scoring single to right, but the O's celebrated the 27th out after fielding a hard Alex Rodriguez bouncer up the middle.

"On this road trip, we hit some balls hard that haven't been hits," Girardi said. "That's baseball, and that's going to happen. You have to fight through that, there's no doubt about it. But we've swung the bats pretty good."