New York Yankees catcher Francisco Cervelli bumps fists with relief pitcher Mariano Rivera (42) after Rivera closed out their 4-3 win over the Arizona Diamondbacks.Associated Press

Travis Hafner’s big hit didn’t surprise CC Sabathia.

Not one bit.

Hafner had a pinch-hit homer in the eighth inning to make a winner of Sabathia, who settled down after a shaky start and helped the New York Yankees beat the Arizona Diamondbacks 4-3 Wednesday night.

“I’ve seen Haf when he’s locked in, so I expect him to do a lot more than he has,” a grinning Sabathia said about his longtime teammate in Cleveland.

Hafner batted for Ben Francisco with two outs in the eighth. He sent the first pitch he saw from reliever David Hernandez (0-1) into the stands in right-center for his fourth home run. It was the fourth career pinch-hit homer for Hafner, and his first since joining the Yankees in the offseason.

“I’m having a lot of fun here,” the player known as “Pronk” said. “I’ve been swinging the bat pretty well.”

The rest of the Yankees have been on a pretty good run, too.

Brett Gardner had a tying, two-run single off reliever Tony Sipp in the seventh for New York. Stymied by Wade Miley for six innings, the Yankees broke through and won for the seventh time in eight games after a 1-4 start.

“With two outs and bases loaded it’s kind of all on you,” Gardner said. “It felt good to come through.”

Sipp had the same feeling going into the at-bat against Gardner. Different result.

“I thought Wade pitched enough to get a win right there. Disappointing,” Sipp said. “My job is to come in and get a batter out, and I didn’t do my job.”

Sabathia (3-1) gave up an opposite-field, two-run homer to Paul Goldschmidt in the first — one of three hits in the opening inning — then only three more hits and a sacrifice fly to A.J. Pollock through the eighth.

Sabathia struck out six and walked one in his third straight win after struggling on opening day. It was his second straight outing of eight innings.

Mariano Rivera pitched the ninth for his fourth save, closing out a game that took just 2 hours, 28 minutes. Injured for most of last season, Rivera posted his first back-to-back saves since April 10-11, 2012.

The Yankees rallied against Arizona for the second straight night. They trailed 2-0 Tuesday.

New York failed to get a runner to second base against Miley until Vernon Wells doubled with two outs in the sixth.

GOOD PITCHER

“He’s a good looking pitcher,” Yankees manager Joe Girardi said. “He gets you to swing at that ball that’s just above the waist and looks really tempting.”

Francisco, the only member of New York’s lineup to face the left-hander before Wednesday, singled with one out in the seventh to start the tying rally.

After Francisco Cervelli struck out, Brennan Boesch doubled and Eduardo Nunez walked to load the bases. Calm and working quickly early, Miley took the throw back after the walk and stomped around the mound. He then walked Jayson Nix to make it 3-1 with several high fastballs.

Miley snatched the ball and stalked around the mound some more before manager Kirk Gibson called for Tony Sipp. Miley bit down hard on a towel in the dugout while Sipped warmed up.

“He was great,” Gibson said of Miley. “His pitch count was low. He just didn’t throw the ball where he wanted to when he needed to in the seventh inning.”

Gardner then slapped a two-run, opposite-field single to left to make it 3-all. The runners advanced to second and third on the offline throw home and side-armer Brad Ziegler relieved and got Wells to ground out.

The Diamondbacks got off to a good start against Sabathia. Pollock doubled leading off and Goldschmidt homered. They put two more on base with one out, but Sabathia struck out Alfredo Marte and got Gerardo Parra to fly out.

“I was all over the place and got a changeup up,” Sabathia said of the pitch to Goldschmidt.

The Diamondbacks added a run in the fifth. Playing second base for the injured Aaron Hill, Josh Wilson hit a drive to right-center and Gardner made a long run before attempting an awkward diving catch. But the ball fell out of Gardner’s big glove before he hit the warning track hard and Wilson made it to third base with a triple. He scored with a headfirst slide on Pollock’s sacrifice fly to right field.

Francisco’s one-out single in the seventh was his first hit with the Yankees. He was 0 for 10 with a walk and hit by pitch.

Martin Prado, who’s played four positions so far this season, made two sharp plays at third to help Miley early.

NOTES: Yankees 1B Mark Teixeira and Cano received their 2012 Gold Gloves before the game. ... Arizona LHP Patrick Corbin (2-0), from the Syracuse area in upstate New York, starts Thursday against RHP Phil Hughes (0-2). ... Arizona dropped to 1-7 in the Bronx during the regular season.