CC Sabathia delivers a pitch during the first inning of a game against the Los Angeles Angels. (June 16, 2013) Photo Credit: AP

ANAHEIM, Calif. - The Yankees found themselves in salvage mode Sunday, desperate for a win to end what had been a miserable trip west.

And typical of this 10-game, three-city trip, even a six-run lead in the ninth didn't make for an easy time. CC Sabathia took the mound that inning leading 6-0, but Mariano Rivera's services still would be needed.

The Angels nearly pulled off an improbable comeback, scoring five times and loading the bases with two outs, Albert Pujols at the plate.

"That's what everybody comes and pays for, those kinds of situations," said Lyle Overbay, who had an RBI double in the Yankees' five-run third inning, which was highlighted by Travis Hafner's three-run homer.

With the Angel Stadium crowd of 41,204 in a frenzy, Rivera won the matchup of future Hall of Famers. He finally ended it by striking out Pujols looking, allowing the Yankees to exhale after a 6-5 victory.

"Get him out," Rivera said of his approach against Pujols, who went 8-for-14 in the series. "There's nowhere to put him. Get him out."

The Yankees (38-31) snapped a five-game losing streak and finished the trip 4-6. They also got some good news when they found out an MRI showed that first baseman Mark Teixeira had not suffered a re-tear of his right wrist tendon sheath.

"More exciting than we wanted," Joe Girardi said of the win.

Sabathia was coming off a rough start Tuesday in Oakland, where he allowed six runs in six innings. He was brilliant until the wild ninth, in which the Angels sent 11 to the plate, had five hits and walked three times against him, David Robertson and Rivera, who picked up his 24th save. Rivera allowed three hits -- all on softly struck flares -- and a run.

"Just what we needed," Girardi said of Sabathia's outing (two runs, five hits in eight-plus innings).

After Mike Trout doubled and Pujols walked to start the ninth, Girardi removed an irritated-looking Sabathia (7-5, 3.93 ERA). Robertson gave up an RBI single and a walk and left the bases loaded for Rivera with one out.

"Joe has a job and he does it pretty good in knowing when guys are done," Sabathia said. "I had no gripes with him, I was just frustrated with myself."

The Yankees had not scored more than four times in any of their previous eight games, including two-run totals in each of their previous four.

They squandered a second-and-third, none-out situation in the first. It looked as if they would be frustrated again in the third before Hafner, with two outs, attacked a 1-and-2 slider from Jered Weaver and hammered it to centerfield for his 11th homer and a 3-0 lead.

"It was good to get a hit," said Hafner, who was in a 5-for-53 skid, including 0-for-23. "This road trip's been brutal for me."

"We've been pressing a lot and you can tell a little bit," said Overbay, who added that the team was "loosened" up by Hafner's homer. "The quality of at-bats wasn't there. We weren't giving ourselves a chance."

The ninth was Rivera's final regular-season game at Angel Stadium, where he lost his major-league debut May 23, 1995. He also got his first career save May 17, 1996 against the Angels at the Stadium.

Afterward, Rivera, who was honored on the field before Saturday's game, wasn't interested in any kind of symmetry.

When asked how badly the Yankees needed a victory, he said: "Big time. We lost the last five. It was important for us to win this one."