SANTA CLARA, Calif. — While Cam Newton shakes off some rust following off-season shoulder surgery, the Carolina Panthers still have their dominant defence to carry them.

Newton overcame a sometimes shaky performance to throw a pair of touchdown passes following San Francisco turnovers and the Panthers shut down Kyle Shanahan's offence in his coaching debut, beating the 49ers 23-3 Sunday.

"The quarterback obviously is still working on his timing," coach Ron Rivera said. "He missed a couple of throws. He knows it. He's upset with himself. I had to talk him off a ledge. He's focusing on what he needs to get done. The nice thing is all the other guys are rallying around him. They understand he's a little rusty.

Newton played only one series in the preseason following off-season surgery to repair a partially torn rotator cuff and looked like a player finding his game.

He completed 14 of 25 passes for 171 yards, and cost Carolina a touchdown when he missed a wide-open Ed Dickson in the end zone in the first half.

But he still managed to do enough to get the win as the Panthers try to rebound from a disappointing 6-10 season in 2016.

Newton threw a 40-yard touchdown pass to Russell Shepard in the first half following a fumble by Brian Hoyer, then a 9-yard touchdown to Jonathan Stewart in the third quarter after Luke Kuechly intercepted Hoyer.

Kuechly looked like his usual self after missing the final six games last season with a concussion.

"Luke was back to being Luke today," linebacker Thomas Davis said. "I was definitely excited to see him doing that. The communication that he has on the field, the things that he's able to see and understand before the play actually happens makes a world of difference for this defence, and I think it showed up today."

The Niners didn't look much improved from last year's outfit that tied a franchise worst with 14 losses. That led to the firing of coach Chip Kelly and general manager Trent Baalke.

Shanahan and new GM John Lynch each got six-year contracts to oversee a massive rebuilding job . There is plenty of work to do as San Francisco was held scoreless in the first half of the opener for the first time in 40 years and lost the first game of the season for the first time since 2010. The Niners finished with just 217 yards of offence.

Hoyer had a rough debut for San Francisco, throwing for only 193 yards and committing the two turnovers.

"It was probably as disappointing as it could have been," Hoyer said. "When you get it handed to you like that, you just have to go in figure out what's wrong, make the corrections and move on."

MCCAFFREY'S DAY

Carolina first-round pick Christian McCaffrey had an up-and-down debut. The former Stanford star gained 45 yards on 13 carries and added five catches for 38 yards. He also lost a fumble in the fourth quarter.

"I didn't play as well as I would've liked to, but anytime you can get a win we're happy," McCaffrey said.

FOURTH-DOWN FOLLIES

Shanahan went twice on fourth down in the first half and failed. Hoyer was sacked by Thomas Davis on fourth-and-4 from the Carolina 44, and Kyle Juszczyk was stuffed by Star Lotulelei on a fourth-and-1 from the 45. The Panthers turned those short fields into a pair of field goals. San Francisco converted one of two fourth-down attempts in the second half.

UNDER PRESSURE

The Panthers put heavy pressure on Hoyer and had four sacks, including one by Wes Horton that forced a fumble by Hoyer. Carolina finished second in the NFL last season with 47 sacks.

ROLLER COASTER

San Francisco safety Jaquiski Tartt had a wild first half that included a missed tackle on Shepard's touchdown, a personal foul for unnecessary roughness, then an acrobatic interception near the goal line on a deep pass to Kelvin Benjamin.

INJURIES

Niners rookie linebacker Reuben Foster had an impressive debut cut short when he injured his right ankle late in the first quarter. Foster got hurt on a run by McCaffrey and was taken to the locker room on a cart. He returned to the field a few minutes later, but didn't get back in the game. Foster said he expects to play next week. Foster had three tackles and a pass breakup before the injury.

UP NEXT

Panthers: Host Buffalo next Sunday.

49ers: Visit Seattle next Sunday.

___

More AP NFL: pro32.ap.org and twitter.com/AP_NFL