Juan Rivera homered twice for Los Angeles, including a tiebreaking drive in the 11th, and Michael Kohn worked out of a jam to earn his first major league save.
Hamilton, the majors' leading hitter at .359, batted third after missing 24 games with two broken ribs, the result of crashing into an outfield wall on Sept. 4.
"It was a good test," Hamilton said.
Before the game, Hamilton said he would be cautious, but he left his feet in the first inning in an effort to make a catch on Bobby Abreu's double.
Later, Hamilton insisted he didn't dive for the ball.
"I'm not that stupid," said Hamilton, who later made two routine catches. "I reached for it, at the last second it was tailing away from me, and I basically fell."
Greeted by a standing ovation, Hamilton fouled out in the first inning. He also grounded out in the fourth and flied to center in the sixth against Jered Weaver before he was removed from the game.
"I felt like my at-bats were good," Hamilton said. "I would have liked to have seen more pitches, but overall, coming back, facing a guy like that for not seeing anything for a month, I felt like I did well. I was seeing the ball well."
Hamilton is expected to serve as the designated hitter Saturday night and start in left field in Sunday's regular-season finale.
Rivera hit a 2-0 pitch from Matt Harrison (3-2) into the left-field seats in his final at-bat, giving Los Angeles a 5-4 lead with his 15th homer.
Rich Thompson (2-0) pitched an inning to get the win and Kohn rescued Los Angeles after Bobby Cassevah allowed the first two batters to reach in the Texas 11th.
Kohn came in and got the first out of the inning when Julio Borbon squared to bunt and then slapped a chopper to shortstop Andrew Romine, who dove to tag third base just ahead of a sliding Mitch Moreland. The ball bounded over the head of third baseman Alberto Callaspo and Romine had to go a long way to get the forceout.
"You don't see that happen very often," Romine said. "You've got to go with it and react."
Kohn then struck out Elvis Andrus and Michael Young to end the game.
Weaver allowed two runs and six hits over seven innings in his final start of the season for the Angels. He struck out four to increase his total to an AL-best 233, one better than Seattle's Felix Hernandez, who won't pitch again this season.
Los Angeles pushed across two runs in the eighth to take a 3-2 lead. Peter Bourjos hit a sacrifice fly and Maicer Izturis had an RBI single.
Rivera hit a drive off Mark Lowe in the ninth to extend the Angels' advantage to two, but Fernando Rodney couldn't preserve the lead.
Bengie Molina's one-out RBI single in the bottom half went off Callaspo's glove, pulling Texas within one. Rodney got Borbon to line out to shortstop, then had pinch-runner Esteban German picked off first and in a rundown. Rodney ran toward German, caught between first and second, and while he hesitated, Moreland took off from third.
Moreland, who also homered twice, slid across the plate ahead of a wide throw from first baseman Rivera, handing Rodney his seventh blown save opportunity.
Rodney "has to give that ball up to an infielder and we'll continue that rundown from there," Angels manager Mike Scioscia said.
Tommy Hunter prepared for a possible playoff start for the Rangers, allowing one run and three hits in five innings. Hunter was recently added to the playoff rotation.
Manager Ron Washington said earlier in the week he would go with a three-man rotation of left-handers Cliff Lee and C.J. Wilson and right-hander Colby Lewis in the division series against Tampa Bay or the New York Yankees.
But Lee would have to pitch on three days' rest to start Game 4, if it's necessary, something Lee has never done before. So the Rangers changed plans and added Hunter, 13-4 overall and 7-0 at home.
Hunter will use bullpen sessions to work on some things.
"I could definitely refine my cutter a little bit," he said. "Every hit I gave up tonight came on a cutter."
Torii Hunter's homer in the fourth gave the Angels a 1-0 lead.
Moreland went deep in the fifth and seventh for his second multihomer game of the season. Weaver had gone 48 1-3 innings without allowing a homer.