GLENDALE, Ariz. (AP) -- Chandler Catanzaro kicked a 34-yard field goal as time expired and the Arizona Cardinals escaped with a 23-20 victory over the San Francisco 49ers on Sunday.
Catanzaro missed twice on game-winning field goal tries earlier in the season, most memorably a 24-yarder in overtime of a 6-6 tie against Seattle.
But this attempt was right down the middle as Arizona (4-4-1) narrowly averted a devastating loss.
The 49ers (1-8) lost their eighth in a row despite a strong game by Colin Kaepernick, who tied it at 20-20 on a 4-yard run with 1:55 to play.
That was enough time for Carson Palmer to gain redemption after three second-half turnovers, the last an interception by Gerald Hodges that led to the tying touchdown.
Palmer completed 4 of 7 passes for 64 yards, including a leaping 26-yard grab by Michael Floyd, as the Cardinals drove from their 15 to the San Francisco 16 to set up the winning kick.
Against the league's No. 32-ranked rush defense, the Cardinals' David Johnson was held to 55 yards on 19 carries.
Johnson, who accounted for both Arizona touchdowns, finished with 101 yards from scrimmage, thanks to that late drive, his ninth straight game of at least 100 total yards.
Kaepernick, returning to the scene of one of the worst games of his career a season ago, completed 17 of 30 passes for 210 yards and ran 10 times for 55 yards.
Larry Fitzgerald caught 12 passes for 133 yards and Floyd caught five for 101 yards, his best game of what had been a difficult season.
Palmer was 30 of 49 for a season-high 376 yards and a touchdown, but the turnovers were almost his undoing.
Arizona, coming off a bye week after a one-sided loss at Carolina, jumped out to a 14-0 lead but couldn't shake the 49ers.
The Cardinals led 20-10 at the half, but didn't score in the second half until the game-winning field goal.