OAKLAND, Calif. (AP) -- Josh Hamilton has had a good final month to the season. He hopes it spills over into next year.
Hamilton hit a tying two-run homer in the ninth inning then put the Angels ahead with a sacrifice fly in the 11th, leading Los Angeles over the Oakland Athletics 5-4 Wednesday.
''I feel like I am having good at-bats even if the results aren't always there,'' Hamilton said. ''If I can build off this last month of quality at-bats, it would be good.''
Hamilton connected against Grant Balfour, who blew his third save of the season. Jesse Chavez (2-4) was the loser.
Mike Trout connected for a two-run home run for the Angels, who won for the fourth time in five games.
''No matter how long you've been playing, you're going to have confidence issues,'' Angels manager Mike Scioscia said of Hamilton. ''We're seeing it all come together the last month. He's a terrific player who has struggled at times earlier in the season.''
Coco Crisp and Yoenis Cespedes each hit two-run home runs for the A's, who lost for the third time in 12 games. But they have a six-game lead over Texas in the AL West. The Rangers play at Tampa Bay.
Juan Gutierrez (1-4) pitched the 10th for the win. Ernesto Frieri worked the 11th for his 35th save in 39 chances.
A's starter A.J. Griffin gave up Trout's homer with one out in the first. He retired 17 of the last 18 batters he faced.
''He's good at baseball,'' Griffin said of Trout. ''I was trying to get him to miss hit, but he got it.''
Griffin allowed two runs on one hit. He walked two and struck out six.
''I'm able to repeat my delivery more often,'' Griffin said. ''I can get the ball and let it fly.''
Angels starter Jason Vargas allowed four runs on seven hits over six innings. He walked two and struck out five.
''I felt good most of the day,'' Vargas said. ''I left a changeup and fastball up to some guys who have hit a few long balls.''
J.B. Shuck doubled leading off the 11th against Chavez. Josh Donaldson mishandled Erick Aybar's sacrifice bunt for an error, putting runners on first and third. After Trout flew out, Hamilton followed with a towering drive to the warning track in left field against Jerry Blevins that put the Angels ahead 5-4.
''I wasn't trying to do too much except get it to the outfield,'' Hamilton said.
Following Jed Lowrie's single leading off the fifth, the A's were held to one hit the rest of the way.
Griffin, who gave up his major league-leading 35th homer, faced three over the minimum. He walked leadoff hitter Shuck and got Aybar to fly out to center ahead of Trout's 26th home run. The only other baserunner was Mark Trumbo, who walked with two outs in the fourth.
Vargas hit Donaldson, who delivered the winning hit Tuesday night, sparking a warning to both teams from home plate umpire Jerry Meals.
Donaldson waved it off.
''Trout got hit pretty good last night,'' he said. ''He might not have been throwing at me. Watching tape it looks like he comes inside to set up other pitches.''
Josh Reddick led off the third with a single. One out later, Crisp tied the score with a drive over the left field wall. Donaldson flew out but Lowrie followed with a single ahead of Cespedes' 24th home run.
NOTES: Trout homered in all three games of the series, the first time he's hit a homer in three straight. ... INF Grant Green started at 2B as the Angels look for ways to get him experience around the infield. He's likely to get time at third, but not this season. ... Angels INF Howie Kendrick was given a scheduled day off. ... The Angels are 7-0-1 in their last eight series. ... RHP Jered Weaver (10-8, 3.36) will make the start for the Angels in Seattle on Friday. He's 13-8 in 27 games against the Mariners. ... RHP Dan Straily (10-7, 4.11) starts for the A's when they open a series against the Minnesota Twins on Thursday night. He's won his last four starts. ... Crews were still cleaning up the mess left by Tuesday night's sewage problem in the A's dugout. ... A's owner Lew Wolff talked to the media beforehand about the playoff situation and extra seating available with the third level tarp being removed.