BALTIMORE (AP) -- Mark Teixeria has tried just about everything to get rid of a nagging cough that has bothered him for the past month.
The timely home run he hit Monday night did nothing to change his health, but it just might turn out to be the cure for his season-long slump.
Teixeira hit a tiebreaking two-run homer in the seventh inning, Curtis Granderson also connected, and the New York Yankees got three hits from Alex Rodriguez in an 8-5 victory over the Baltimore Orioles .
Teixeira had five hits in his previous 33 at-bats and was hitting .220 when he drove a 1-2 pitch from former Yankee Luis Ayala (1-1) into the right-field seats. He also doubled in the ninth and scored on a fly ball by Eric Chavez .
"I hope that helps put me on a roll," he said.
Asked if his two-hit, two-RBI performance made him feel any better, Teixiera replied, "I'd like to say yes. I want to be positive, but the truth is ... not really. I'm just trying to grind through it. In this game, you're always playing through something."
It was the fourth win in five games for the Yankees, who improved to 4-0 at Camden Yards this season.
New York shortstop Derek Jeter got his 3,143rd hit, a single up the middle in the third inning, to move out of a tie with Robin Yount into sole possession of 16th place on the career hit list.
J.J. Hardy homered and had three RBIs for the Orioles, who dropped into a tie with Tampa Bay atop the AL East. After going hitless in his first big league game Sunday, Orioles leadoff hitter Xavier Avery doubled, tripled, scored twice and drove in a run.
"X had a good night," Baltimore manager Buck Showalter said. "I was real proud of him."
Yankees starter Ivan Nova allowed five runs and seven hits in 5 1-3 innings. He left in the sixth with a bruised and sprained right foot after chasing down a grounder toward the first-base side. The right-hander took a line drive off the top of the same foot in the third inning, courtesy of Nick Markakis , but shook it off.
"On that last play I twisted it," Nova said. "I don't want to miss any starts. Hopefully, it will feel better. It is a little (swollen) right now."
David Phelps (1-1) entered in the sixth and got three outs for his first major league win. Rafael Soriano , the sixth New York pitcher, worked the ninth for his second save.
The Yankees are operating without injured closer Mariano Rivera , and manager Joe Girardi revealed that late-inning specialist David Robertson has soreness in his left side and could undergo an examination Tuesday.
"I was hoping it was one of those things that would go away," Robertson said. "But it keeps hanging around. Honestly, I don't think it's too bad."
Orioles starter Jason Hammel gave up five runs, four earned, in five-plus innings. He was seeking to become the first pitcher in Orioles history to begin a season with seven straight starts of allowing two or fewer runs.
After a 14-minute rain delay, Baltimore jumped to a 2-0 first-inning lead. Avery led off with a double and received hearty congratulations from Jeter at second base after his first major league hit. Hardy followed with an RBI single and Adam Jones doubled in a run.
The Yankees pulled even in the fourth when Nick Swisher hit a two-run double following singles by Rodriguez and Robinson Cano .
In the fifth, Granderson launched a 2-1 pitch over the right-field scoreboard, the 61st homer in the 21-year history of Camden Yards to land on Eutaw Street.
Baltimore went up 5-3 in the bottom half. Avery tripled in a run and Hardy followed with a drive into the left-field seats.
New York tied it in the sixth. A leadoff double by Cano and two walks loaded the bases with no outs, ending Hammel's night. Ayala got Chavez to hit a bouncer to first, but the ball went under Chris Davis ' glove and rolled into right field as two runs scored.
"I tried to make throw before I caught it," Davis said. "It was hit hard. But it's still a play that's got to be made."
After a one-out walk loaded the bases, Ayala struck out Jeter and retired Granderson on a fly to right.
NOTES: Cano went 2 for 5 and is batting .469 (15 for 32) in his last eight games. ... Davis went 0 for 4 and is mired in a 3-for-28 skid. ... One day after making his first major league start since 2010, New York LHP Andy Pettitte said, "I feel good. I really do."... New York opponents have scored within the first two innings in 28 of 35 games this season. ... Orioles INF Zelous Wheeler, who was designated for assignment on Friday, cleared waivers and was outrighted to Double-A Bowie.