BALTIMORE (AP) -- Andy Pettitte retired his first 20 batters before a lamentable seventh-inning sequence spoiled both his perfect game and no-hit bid, and the New York Yankees beat the Baltimore Orioles 5-1 Monday night.
Pettitte (12-6) was poised to finish the seventh without allowing a baserunner, but former Oriole Jerry Hairston Jr. let a two-out grounder by Adam Jones slip through his legs for an error. Hairston was playing in place of Alex Rodriguez, who was given the night off.
Nick Markakis followed with an opposite-field single inside the third-base line, drawing further groans from a crowd of 25,063 filled with Yankees fans.
After Melvin Mora led off the eighth with a home run, Pettitte completed his masterful effort by getting three straight outs.
The 37-year-old Pettitte took his dominance of the Orioles to a new level with a vintage pitching gem that enabled him to move into sole possession of third place on the Yankees career wins list. He broke a tie with Lefty Gomez with his 190th victory with New York, a number bested by only Hall of Famers Whitey Ford (236) and Red Ruffing (231).
Pettitte allowed one run and two hits, struck out eight and walked none to improve to 4-0 in his last seven starts. He's 26-6 lifetime against the Orioles, including 16-4 in Baltimore.
It was the first time Pettitte went eight innings since July 20, 2008.
Brian Bruney gave up a walk and a single in the ninth before Mariano Rivera got two outs for his 37th save - and career-best 33rd in a row.
The only thing resembling a close call against Pettitte over the first six innings came when Matt Wieters topped a slow grounder to third with one out in the sixth. Hairston picked up the ball barehanded, and his off-balance throw got Wieters by a step.
Nick Swisher homered and had three hits for the AL East-leading Yankees, who have won four straight and 21 of 27. New York is 10-3 against the Orioles this season.
Baltimore starter Jeremy Guthrie (9-13) allowed two runs and four hits in six innings. The right-hander was good, but on this night he needed to be near perfect to outpitch Pettitte.
Guthrie matched Pettitte for two innings, retiring the first six batters before Swisher led off the third with his 22nd homer and fourth against Baltimore. Melky Cabrera followed with a one-out double but did not advance.
New York used successive doubles by Robinson Cano and Swisher to make it 2-0 in the fourth.
The Yankees pulled away with a three-run eighth that featured an RBI single by Johnny Damon and a two-run double by Cano.
NOTES: The Yankees announced ticket prices for potential postseason home games. They range from $5 to $425, and some seats will cost less than they did during the regular season. Season-ticket holders will get the first chance to buy postseason tickets. The date for any public sale hasn't been determined yet. ... Orioles rookie Nolan Reimold's career-high run of reaching base in 17 straight games ended. ... Yankees RHP Sergio Mitre, who left his last start after being struck in the right arm by a line drive, played light catch in the outfield before the game. Manager Joe Girardi said RHP Chad Gaudin would start Thursday at Toronto if Mitre cannot.