Hideki Matsui hit a 2-2 pitch from Jim Johnson over the wall in right in the last of the 9th and the Yankees picked up a 2-1 win over the Orioles Monday night.
It was his 15th of the year.
New York has now won eight home games in a row over the Orioles, who fall to 1-12 on the year in AL East road games.
New York has won four in a row and is 17-5 over its last 22 games.
The O's lost a game in which they gave up just four hits.
The Orioles took a 1-0 lead in the first on a Nick Markakis solo homer. He hit an 0-1 pitch from Andy Pettitte out of the park for his 10th of the year and his second homer in the last four games.
Eric Hinske's solo homer in the last of the second tied the game at 1-1. It was his 4th of the season.
The O's missed a chance to break the 1-1 tie in the 8th. With one out, a Brian Roberts double advanced Cesar Izturis to third. But Izturis was cut down at home on a groundout and Roberts was out at home when a pitch got away from the catcher.
O's starter David Hernandez pitched a strong game. In six innings, he gave up just three hits and one run, throwing 103 pitches. Pettitte gave up just one run over 7 1/3 innings.