Updated

Mark 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 on Monday night.

It was the fourth win in five games for the Yankees, who improved to 4-0 at Camden Yards this season.

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.

Before the game, Yankees manager Joe Girardi said Teixiera has been battling a nagging cough for a month but added, "Tex is a tough kid. ... I think it's too early to get worried. We've seen these slow starts out of Mark before."

Teixeira also doubled in the ninth and scored on a fly ball by Eric Chavez.

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.

Yankees starter Ivan Nova allowed five runs and seven hits in 5 1-3 innings before leaving with a bruised and sprained right foot. 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.

David Phelps (1-1) entered in the sixth and got three outs. Rafael Soriano, the sixth New York pitcher, worked the ninth for his second save.

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. 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.