ARLINGTON, Texas -- Jurickson Profar watched the first four-error inning for Texas from the bench.
When he got the call as a pinch-hitter in the ninth inning, the rookie erased that bad memory and gave the Rangers at least another day of realistic playoff hopes.
Profar homered leading off the ninth, and the Rangers beat the Los Angeles Angels with a walk-off homer for the fourth straight time at home in a 6-5 victory Thursday night.
The Rangers matched a win by Cleveland for the third straight night to stay within a game of the Indians for the second wild-card spot in the American League.
Cleveland beat Minnesota 6-5, and Tampa Bay stayed a game ahead of the Indians after finishing a three-game sweep of the New York Yankees.
Texas manager Ron Washington said he was just looking for a leadoff hit when he went with Profar after sending Lance Berkman to the on-deck circle in the bottom of the eighth.
"And he gave me the opposite of what I was looking for," Washington said. "But it was huge."
Profar's sixth homer landed about 10 rows into the stands down the right-field line. It was off Michael Kohn (1-4), who also gave up Beltre's winning blast on July 31.
"It's definitely weird, four walk-offs in a row," Kohn said. "It's not the ballpark. It's just a matter of executing pitches."
Joe Nathan (6-2) got the win after striking out two with a runner at third and one out in the top of the ninth.
"We're alive another day," said Texas starter Matt Garza, who gave up 11 hits in 5 1-3 innings but allowed just one earned run because of the defensive meltdown behind him. "That's what we're playing for right now. We're just playing to get in any way we can do it."
Josh Hamilton, back in Texas with a chance to damage the postseason hopes of a team he helped lead to consecutive World Series in 2010 and 2011, went 1-for-3 with two walks. He was on third in the ninth when Mark Trumbo struck out to end the inning.
Moments before his at-bat, Trumbo was in the on-deck circle when he had to duck to avoid a line drive from Kole Calhoun. Trumbo went to the dugout but emerged about a minute later.
"It grazed me," said Trumbo, who snapped an 0-for-25 skid with three hits, including a tying single in the seventh after Calhoun led off with a triple off Tanner Scheppers. "Sure, it was a little bit scary. No blood, no foul."
An inning before Trumbo's tying hit, Martin put Texas ahead with a big double for the second straight night. Martin's two-out double into the gap in right-center scored Craig Gentry, who had three singles, and pinch-runner Adam Rosales for a 5-4 Texas lead.
The Angels scored three unearned runs for a 4-3 lead in the second when the Rangers set a club record with the four errors.
After a single by J.B. Shuck, second baseman Ian Kinsler let a routine grounder from Erick Aybar get past him into shallow right field. Romine scored easily from second, and Kinsler got another error when his throw hit Shuck in the back at third, allowing Aybar to take second.
Beltre's throwing error on an infield single by Mike Trout allowed Aybar to score the third unearned run.
The franchise had four errors in 1962 when it was still in Washington, but the Rangers never had more than three. The last time they had three was in 2005 against Seattle.
"You just keep making pitches," Garza said. "It's not like they're trying to do it, just like you're not trying to make a bad pitch."
Garza kept the game close in the fifth, with a little help from his defense. After consecutive singles from Howie Kendrick and Calhoun, Kendrick was thrown out at home by Gentry on a single to left by Trumbo.
After Chris Iannetta walked to load the bases with one out, Garza got Romine on a fly ball to shallow right and Shuck on a soft liner to Moreland.
Angels starter Jerome Williams gave up nine hits and three runs in five innings and left with a chance to match his career high with a win in five straight starts. He did it his rookie year in 2003.
Shuck, the Angels' left fielder, left the game in the fifth with a sprained right ankle. ... The Rangers' previous club record for errors in an inning was three, done 14 times. The most recent was Sept. 15, 2005, at home against Seattle. ... The Angels missed a chance to get within a game of .500 for the first time since they were 2-3 on April 6 after a win at Rangers Ballpark. ... The crowd of 26,198 pushed the Rangers past 3 million in attendance for the second straight year.