GLENDALE, Ariz. (AP) -- Kurt Warner's ageless arm and an improbable goal-line stand at the finish saved the Arizona Cardinals from an ugly loss on a national stage. The Cardinals stopped Michael Robinson up the middle from the 2-yard line as the game ended Monday night to preserve a 29-24 victory over the San Francisco 49ers.
Warner finished 32-of-42 for 328 yards and three touchdowns without an interception in Arizona's sixth consecutive home victory, fourth this season.
The NFC West-leading Cardinals (6-3) never led until Karlos Dansby's 34-yard interception return set up Warner's 5-yard TD pass to Anquan Boldin with 4:16 to play.
San Francisco (2-7) had two chances after that.
The first ended on Adrian Wilson's diving interception of Shaun Hill's pass. The second was much more nerve-racking for the home team and exasperating for the 49ers, who lost their sixth in a row.
Hill's 14-yard pass to Jason Hill moved it to the Arizona 1. With the last few seconds ticking off, 49ers running back Frank Gore was pushed by a defensive player as he ran around left end, then stumbled to the ground just outside the 2.
After officials reviewed the play to make sure Gore was down by contact, the 49ers handed off to the fullback Robinson, who was stuffed nowhere near the goal line.
The Cardinals opened a four-game lead in the NFC West. The other three teams in the division - San Francisco, Seattle and St. Louis - are all 2-7.
Allen Rossum returned the opening kickoff 104 yards for a touchdown and the 49ers never trailed until Arizona's late score.
Shaun Hill, replacing the benched J.T. O'Sullivan for his third career start in seven NFL seasons, threw for two touchdowns in the first half but lost a fumble and threw two interceptions in the second.