GLENDALE, Ariz. (AP) The Arizona Cardinals didn't need their starting quarterback to beat a longtime nemesis and stay atop the toughest division in football.
Backup Drew Stanton did just fine.
Stanton threw a pair of third-quarter touchdown passes to rookie John Brown and the Cardinals rallied to beat San Francisco 23-14 on Sunday. Arizona snapped a four-game losing streak to San Francisco and beat the 49ers for just the second time in their last 11 meetings.
Tommy Kelly blocked a field goal for the Cardinals (3-0), who outscored San Francisco 17-0 in the second half.
The 49ers (1-2) mounted 80-yard touchdown drives the first two times they had the ball, then didn't score again, blowing a halftime lead for the second week in a row.
Stanton, starting for injured Carson Palmer for the second straight week, completed 18 of 33 passes for 244 yards and two scores. He has yet to be intercepted. Michael Floyd caught five for 114 yards.
The Cardinals, alone atop the NFC West, have a bye next week.
''It sets the table for some really good things to come,'' Stanton said.
The 49ers' Colin Kaepernick completed 29 of 37 passes for 245 yards and a touchdown and ran for another 54.
A week ago, San Francisco led 17-7 and lost at home to Chicago 28-20. This season, San Francisco has outscored opponents 59-16 in the first two quarters, but been outscored 52-3 in the second half.
Coach Jim Harbaugh, a man of very few words after the loss, was asked if he had an explanation for the second-half troubles.
''No, I don't,'' he said. ''We've just got to play better. We're not playing good enough right now.''
The 49ers were up 14-6 at the break this time before Stanton connected with Brown on touchdown passes of 24 and 21 yards.
''Coming out the whole practice, the game plan was around me to try to get the ball in my hands more,'' Brown said, ''because a lot of people are looking at Larry (Fitzgerald) and Michael. It just opened up big-time, so I was just prepared for it.''
Stanton said Brown is so smooth and fast.
''If you blink, he might be on the other side of you,'' Stanton said, ''and then it's over.''
Stanton quarterbacked the Cardinals to a 25-14 road win over the New York Giants a week ago, his first regular-season game since 2010. He was even sharper against San Francisco. Afterward he said his first NFL start, back in 2009, was against the 49ers. He threw three interceptions and was benched at halftime.
He said ''a little bit of weight'' had been lifted from his shoulders.
''I'm just so fortunate and blessed really to be able to be in this opportunity,'' Stanton said, ''because most guys that go four years without a start, they're not around the league too long.''
Arizona showed no sign of being distracted after backup running back Jonathan Dwyer was arrested on a domestic abuse charge earlier in the week. Dwyer has been placed on a non-football injury list and is gone for the season.
''For us to go undefeated in September is a huge step forward with all the things that have gone on the past two weeks,'' Arizona coach Bruce Arians said. ''I love the resiliency of our football team, the focus that they bring every single day to work.''
San Francisco was penalized nine times for 107 yards, and Anquan Boldin felt some of them were undeserved, something he said has been a pattern.
''Every week is the same thing,'' Boldin said. ''You send the tape in and the NFL reports back that `we made a mistake' but at the same time (that) is costing us games. At some point, they need to be held accountable.''
The 49ers were without tight end Vernon Davis (ankle injury) and his backup Vance McDonald (knee), as well as starting right tackle Anthony Davis (hamstring) and cornerback Tramaine Brock (toe).
Palmer remained sidelined with a nerve problem in his throwing shoulder.
A late-hit penalty on Dan Skuta, followed on the next play by a roughing-the-passer call against Patrick Willis, accounted for nearly half of Arizona's go-ahead 66-yard touchdown driver.
On third-and-8 from the Cardinals 17, Stanton lofted a 45-yarder to Floyd for the drive's big play. Stanton found Brown alone again from 21 yards out for the score.
Down 20-14, San Francisco drove to the Arizona 5 but an unnecessary roughness penalty against Boldin for head-butting the Cardinals' Tony Jefferson pushed the 49ers back.
Then, the 6-foot-6, 310-pound Kelly knocked down Dawson's field goal try and the Cardinals' Ed Stinson pounced on it near midfield.
Chandler Catanzaro's third field goal of the afternoon, from 35 yards, sealed it in the waning seconds.
NOTES: The Cardinals lost cornerback Antonio Cromartie in the first half to a knee injury. ... Previously, the 49ers' lone loss to the Cardinals since 2008 was on Dec. 11, 2011. ... San Francisco plays its next two at home, against Philadelphia and Kansas City. ... Fitzgerald ran his string of consecutive games with a reception to 152.
AP NFL website: www.pro32.ap.org and www.twitter.com/AP-NFL.