Hamilton hit a tying two-run homer in Los Angeles' three-run ninth inning, and the Angels rallied for a 6-5 victory over the St. Louis Cardinals on Thursday night.

"It was just a good feeling to hear that sound come off your bat," Hamilton said. "... It couldn't happen on a better day for the crowd on the Fourth of July. They got a little more fireworks and a little more bang for their buck than they thought they were going to get. It was cool.

"Anytime you can contribute like that, especially in the late innings and have a comeback like that, it's a pretty special feeling."

Mark Trumbo belted his 19th homer and Mike Trout had two RBIs for Los Angeles, which took two of three in the series. Scott Downs (2-2) got three outs for the victory.

"Whether we won that game or not, this team never gives up," Albert Pujols said. "I mean, we've got 12 or 13 position players that really compete every day. Our bullpen threw the ball well to keep us in the game."

St. Louis ace Adam Wainwright, the NL pitcher of the month for June, took a 5-3 lead into the ninth before giving up a leadoff single by Pujols, who was 1-for-11 in his first series against his former team. Manager Mike Matheny then brought in Mujica, who had converted 21 of 21 save opportunities this season. But Hamilton drove the right-hander's second pitch into the center-field trees for his 11th homer, extending his hitting streak to nine games and raising his average to .226.

"Players I've talked to about him said he's not afraid to throw his split five or six times in a row, because that's his go-to pitch. So he's going to stick to what has been working for him," Hamilton said. "I didn't try to do too much with it. I didn't try to yank it or anything like that -- just hit it back up the middle."

Howie Kendrick and Trumbo followed with singles, and Mujica (0-1) retired his next two batters before Erick Aybar drove in the winning run with an opposite-field single to left. Aybar had three hits and scored a run for Los Angeles.

Mujica acknowledged that he shook off batterymate Yadier Molina on the ill-fated pitches to Hamilton and Aybar.

"I made two big mistakes. I didn't follow Yadier on a couple of pitches, and that was the ball game," Mujica said. "He called for a fastball on Hamilton and I threw the changeup. On Aybar, he called for a fastball again and I decided to throw my changeup. I threw a couple good changeups and got two popups, so I figured I'd go with my best pitch."

Wainwright, the only Cardinals pitcher averaging at least seven innings per start, defended Matheny's decision to take him out after 104 pitches. His season high is 120, on May 11 in a two-hit shutout against Colorado.

"We've always liked that situation. He's the right guy in that situation," Wainwright said of Mujica. "He's been great all year. That's what happens when you let a leadoff guy on in the last inning. That's on me, right there. I have to go out and get that guy out."

Angels starter Joe Blanton gave up five runs, four earned, and nine hits in 5 2/3 innings. The right-hander, who signed a $15 million, two-year contract with Los Angeles over the winter, is 0-4 with a 5.17 ERA in nine starts this season at Anaheim Stadium.

Blanton averaged 13 pitches through the first three innings while retiring nine of his first 10 batters. But just three batters into the fourth, the Cardinals pulled ahead 3-2 on a single by Carlos Beltran, a walk to Matt Holliday and Allen Craig's homer. Craig leads the majors with a .469 average with runners in scoring position.

It was the seventh straight start in which Blanton gave up a home run.

The Angels tied it in the bottom of the fourth on Trumbo's drive to center. But the Cardinals got the run back in the fifth on Matt Carpenter's sacrifice fly, and then made it 5-3 in the sixth on a two-out RBI single by Daniel Descalso that chased Blanton, who has given up a major league-worst 135 hits.

The Angels opened the scoring in the third on a two-out, two-run single by Trout, after Wainwright gave up singles to Alberto Callaspo and Aybar, and J.B. Shuck advanced them with a sacrifice bunt.

Game notes

Hamilton, the only player in the Angels' starting lineup who had faced Wainwright previously, was 0-for-2 against him after coming in 3-for-7. ... St. Louis' Jon Jay played his 227th consecutive game in center field without an error, breaking Curt Flood's franchise record for any outfield position. ... Holliday was back in the Cardinals' lineup as the designated hitter, going 0-for-3 with two strikeouts and a walk after missing two games because of a pinched nerve in his neck. ... Trout leads the Angels with 55 RBIs, just two fewer than he had through his first 84 games last season, when he finished with 83 and was named AL rookie of the year after spending the first month of the season at Triple-A. ... RHP Lance Lynn's next start for the Cardinals will be Sunday at home against the Miami Marlins. He has two chances left to become the sixth pitcher in Cardinals history to post at least 11 wins before the All-Star break in consecutive seasons, and the first since Joaquin Andujar (1984-85). The others were Dizzy Dean, Bob Gibson, Mort Cooper and Gerry Staley.