ANAHEIM, Calif. — After eight innings of offensive frustration against CC Sabathia, the Los Angeles Angels broke through with five hits and five runs in the dramatic ninth.

But when Albert Pujols came up against Mariano Rivera with the bases loaded and two outs in a one-run game, the Angels' $240 million man couldn't connect.

Rivera struck out Pujols on three pitches to end it, and the Yankees stopped their five-game skid with a wild 6-5 victory over Los Angeles on Sunday, ending the Angels' three-game winning streak.

Although Rivera survived a rocky outing in the stadium where he made his major league debut and got his first save, the Angels lost much earlier when Sabathia outpitched Jered Weaver, who gave up five runs in the third inning.

The Angels' ace allowed seven hits and four walks over six innings, and Los Angeles managed just four singles off Sabathia until the crazy ninth.

"I didn't really accomplish anything that I try to accomplish through the course of a game," Weaver said. "Walks were bad, first-pitch strikes were bad, and I obviously didn't get deep in the game. It's just one of those games where I found myself battling the whole game."

Sabathia pitched five-hit ball into the ninth, and Travis Hafner hit a three-run homer, but the Yankees barely got enough from Rivera. New York's famed closer gave up three hits and a walk, but still got his 24th save in dramatic fashion.

"That's what everybody comes and pays for," said Lyle Overbay, who had an RBI double. "That was a little closer than we thought, but I didn't sense a lot of panic."

Jayson Nix also drove in a run during the five-run third for the Yankees, who salvaged the finale of their 10-game road trip by battering Weaver (1-3) early and hanging on late.

Sabathia (7-5) struck out six and walked three, but tired in the ninth, leaving with two runners on. After reliever David Robertson left with a 6-1 lead, Rivera gave up Erick Aybar's RBI groundout, Alberto Callaspo's two-run single and Peter Bourjos' RBI single.

Rivera then walked Mike Trout to load the bases before getting Pujols.

"That was a great rally and a lot of fun to be a part of," said Mark Trumbo, who drove in the Angels' first run in the ninth. "You know the odds are heavily stacked against you, especially with a guy like CC out there. That's exactly what we wanted to see. It was very, very close, and that's about all you can hope for against a guy like Mariano Rivera. Maybe one more blooped (hit) and we win this ballgame."

Former Angels outfielder Vernon Wells drove in what turned out to be the decisive run with a sacrifice fly off Jerome Williams in the eighth.

Sabathia left after Trout's leadoff double and a walk to Pujols. Trumbo then got an RBI with a line drive that hit Robertson and bounced into right field for a single. Robertson stayed in the game, but loaded the bases with a one-out walk to pinch-hitter J.B. Shuck.

That created an unlikely save opportunity with a five-run lead for Rivera, but the 43-year-old closer wasn't sharp. Aybar and Callaspo drove in runs before pinch-hitter Brad Hawpe delivered his first major league hit in two years.

"We really executed well in the ninth inning and had some good at-bats," Angels manager Mike Scioscia said. "There was some good situational hitting, and some guys off the bench did a good job. Unfortunately, we couldn't get that tying run across. Rivera made some tough pitches to Albert at the end and closed the door, but our guys were upbeat the whole game."

Weaver struck out six, but repeatedly found trouble in his fourth start since returning from a 45-game stint on the disabled list. A 20-game winner last season, the Angels' longtime ace is winless in his last three starts.

Weaver had two outs and two strikes on Hafner before the veteran hit his 11th homer. Hafner had just five hits in his previous 53 at-bats before connecting, including a 2-for-27 start to the road trip.

NOTES: New York 1B Mark Teixeira got a cortisone shot in his injured right wrist and will be re-evaluated next week, but Yankees manager Joe Girardi said the tendon sheath around his wrist is just inflamed, not torn again. Teixeira left Saturday's game in the fourth inning and returned to New York for examination on his wrist, which kept him out for the first 53 games of the season. ... Ichiro Suzuki stole another base, giving him three steals in two games. The Japanese star had just six stolen bases all season before the weekend. ... Josh Hamilton got a day off for the Angels, not even pinch-hitting in the ninth.