Elise Amendola, Associated Press
BOSTON — Chris Davis hit a tiebreaking two-run single with two outs in the 12th inning, lifting the Baltimore Orioles to a 5-3 win over the Boston Red Sox on Wednesday night.
Matt Wieters had a pair of RBI doubles for Baltimore, which closed to one game back of Texas for the AL's second wild-card spot. The Rangers lost 4-3 in 12 innings to the wild card-leading Rays.
Despite the loss, the Red Sox reduced their magic number to one for clinching their first postseason berth since 2009 when the Cleveland Indians lost to the Kansas City Royals 7-2 on Wednesday.
T.J. McFarland (2-1) worked the 11th for the win and Jim Johnson got the final three outs for his AL-leading 47th save.
The Orioles played their 114th errorless game, surpassing the 2008 Houston Astros for the majors' most since 1900.
J.J. Hardy and Brian Roberts had consecutive one-out singles and both advanced on a wild pitch by Franklin Morales (2-2). After pinch-hitter Steve Pearce was intentionally walked, Manny Machado fouled out before Davis' grounded one up the middle into center field.
Boston had runners on first and second with one out in the 11th, but Stephen Drew grounded into a double play.
David Ortiz hit his 28th home run — a two-run shot — and Mike Naploi added a solo homer for the Red Sox.
Baltimore had pulled in front 3-2 in the sixth on Wieters' RBI double, but Napoli hit his solo homer into the center field bleachers leading off the bottom of the inning against Wei-Yin Chen.
Boston jumped ahead 2-0 in the first on Ortiz's long homer into the seats about 15 rows back in right field. Victorino singled before Ortiz hit the first pitch, holding his bat and admiring his drive for a while before rounding the bases.
Boston starter Jake Peavy went seven innings, allowing three runs, six hits, striking out eight and walking one.
Chen gave up three runs on 11 hits, striking out five without a walking a batter in 5 2-3 innings.
Boston closer Koji Uehara pitched a perfect 10th one night after having his club-record streak of retiring 37 consecutive batters snapped and taking the loss.
Baltimore tied it with two runs in the fifth. Danny Valencia had the Orioles' first hit — a leadoff single — and scored on Wieters' double into the center field triangle just over the glove of Victorino's running bid. Roberts' RBI doubled tied it.
Mixing a well-spotted fastball with a slider and change up, Peavy struck out seven and opened the game with four hitless innings. He walked Roberts on for the first base runner with two outs in the third.
The Red Sox had the bases loaded with no outs in the third, but Napoli lined to short and Jonny Gomes bounced into a double play.
NOTES: Boston CF Jacoby Ellsbury, sidelined for his 11th straight game after breaking a small bone in his right foot, said he's still planning to be back by the end of the regular season. "I'm making great progress. The doctors are pleased with how things are going," he said. "I'm taking it day by day." ... Baltimore manager Buck Showalter said he'll know Thursday whether Miguel Gonzalez (sore right groin) or Bud Norris (sore right elbow) will be able to start Saturday. "Miguel feels pretty good today. That's pretty encouraging," Showalter said. "I was surprised. He might be a choice for Saturday. He's going to throw (Thursday). I'm going to make a decision (Thursday) whether it's Miggy, Bud or somebody else." ... Boston manager John Farrell said "I can see us going with 11 pitchers," when asked his plan for a probable Divisional playoff series. ... The Red Sox sold over 4,000 tickets for $1 to fans wearing a real or fake beard Wednesday, helping push the attendance to a season high 38,540. ... Chris Tillman (16-6, 3.70 ERA) goes for Baltimore in the series finale Thursday against John Lackey (9-12, 3.56). ... The teams meet again at Camden Yards for three games in the final weekend of the regular season.