MLB

Hafner, Yankees rally past Orioles

BALTIMORE — CC Sabathia against the Orioles and Freddy Garcia last night was a mismatch everywhere but inside Camden Yards, which is the only place that mattered.

Las Vegas had the Yankees a favorite over the Birds, who were riding a five-game losing streak and giving the ball to the ancient Garcia, an ex-Yankee whose best days have been over for a while. And there was the matter of Sabathia dominating the Orioles throughout his career.

Still, after eight innings the Orioles were in position to win.

But Travis Hafner’s ninth-inning homer off Jim Johnson tied the score and the Yankees scored twice an inning later when Hafner helped with an RBI single to escape with a 6-4 victory in 10 innings before 24,133.

It was the third straight win and 10th in 13 games for the Yankees (28-16). The Orioles (23-21) have lost six in a row.

Consecutive doubles by Ichiro Suzuki and Vernon Wells starting the 10th off Pedro Strop put the Yankees in the lead. Hafner delivered a two-out RBI single that upped the lead to 6-4. To cap off a splendid night, Hafner swiped second; his second theft of the season.

Mariano Rivera recorded the final three outs for his 17th save in 17 chances. As Rivera jogged in from center field to pitch the 10th, Orioles fans joined Yankee supporters in applauding baseball’s all-time saves leader.

Asked to protect a one-run lead in the ninth, Johnson gave up a one-out, solo homer to Hafner that tied the score, 4-4, and saddled Johnson with his third straight blown save.

Lyle Overbay, who hit one of the four Yankees homers, followed with a single to center off Johnson, but Curtis Granderson whiffed and David Adams grounded out.

Sabathia hasn’t won since April 27 (four starts). He gave up four runs and 11 hits in 6 1/3 innings. In his last two outings, the Yankees’ ace has surrendered 21 hits in 12 2/3 innings. It’s only the third time Sabathia has given up double-digit hit totals in back-to-back games in his career.

Hafner’s late-game jolt avoided Sabathia’s excellent resume against the O’s from taking a hit. He is 17-4 overall and 10-3 at Camden Yards.

Alexi Casilla, the Orioles’ ninth-place hitter, started the seventh with a single to right that was the beginning of the end for Sabathia.

Casilla scored from first on Nick Markakis’ opposite-field double to left-center on a 1-2 pitch and tied the score, 3-3. Sabathia induced Manny Machado to ground out to short, but J.J. Hardy dumped an opposite-field double into right field that scored Markakis and put the O’s ahead, 4-3.

Joe Girardi called for Shawn Kelley to face Adam Jones. Kelley fanned Jones with a 1-2 slider in the dirt and intentionally walked Chris Davis. That brought switch-hitter Matt Wieters to the plate and Kelley struck him out with a 2-2 slider.

Though, the right-handed Garcia needed only 66 pitches to get through six innings, Orioles manager Buck Showalter called for lefty Troy Patton to start the seventh.

Based on Overbay’s numbers against lefties this season (5-for-42; .119), it was hard to argue with Showalter’s choice even if left-handed hitters were batting .310 (9-for-29) against Patton.

And when Patton’s first two pitches were strikes, the strategy indeed looked brilliant. Three pitches later Overbay broke a 2-2 tie with a towering homer to right-center. It was his seventh homer of the season.

It was also the Yankees third homer of the game. Robinson Cano and Adams homered in the first and second innings, respectively.

Back-to-back one-out walks issued by Garcia to Brett Gardner and Cano in the sixth inning gave the Yankees a chance to bat with a runner in scoring position for the first time.

Hafner hit the ball hard enough to the right side but Casilla’s diving stop started an inning-ending, 4-6-3 double play and kept the score tied, 2-2.

George.king@nypost.com