The San Francisco 49ers held the Los Angeles Chargers to a scoreless second half as they came from behind to defeat their California foe, 22-16, Sunday night. 

The Niners went down immediately when the Chargers scored a touchdown on their opening drive, as quarterback Justin Herbert found DeAndre Carter for a 32-yard score. 

Los Angeles would go up as much as 10 on the road in the first half, but the Niners’ defense has been solid all season, and they turned it up a notch in the second half to allow the offense to do just enough for the victory. 

That came in the form of Christian McCaffrey, who has fit in quite nicely since being traded by the Carolina Panthers to join the playoff contender in the NFC West. After forcing the Chargers’ second punt of the half, Jimmy Garoppolo and the 49ers’ offense got to work. 

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Jimmy Garoppolo throws ball

Jimmy Garoppolo #10 of the San Francisco 49ers throws a pass during the second quarter against the Los Angeles Chargers at Levi's Stadium on Nov. 13, 2022 in Santa Clara, Calif. (Ezra Shaw/Getty Images)

They killed almost seven minutes of the clock and executed 14 plays that would eventually be capped with a two-yard touchdown run for McCaffrey on a no huddle play to take the lead 19-16. 

The Chargers still had opportunities to at least tie the game and send it to overtime, but Herbert just couldn’t get anything going after the McCaffrey score. 

The Chargers went three-and-out, and after forcing the 49ers to punt, they were down at their own one-yard line – Terry McAuley, NBC’s rules analyst, believed that the Chargers should’ve been further up because the gunner fell back into the end zone with the ball, but that never occurred – and turned it over on downs with pressure from Nick Bosa leading an incompletion. 

CHARGERS' BRANDON STALEY ON CUTTING 2019 FIRST-ROUND PICK: ‘WASN’T GOING TO BE A FIT ANYMORE'

San Fran would kick a field goal, leaving just under one minute to play for Herbert to pull off a miracle victory with a touchdown. But, on his first pass attempt, he was picked off by Talanoa Hufanga to end the game. 

Josh Palmer catches ball

Joshua Palmer #5 of the Los Angeles Chargers catches a pass during the third quarter against the San Francisco 49ers at Levi's Stadium on Nov. 13, 2022 in Santa Clara, Calif. (Thearon W. Henderson/Getty Images)

Herbert had a trying night in San Francisco after a Dre Greenlaw helmet-to-helmet hit sent him into the locker room before the first half ended. Chase Daniel would finish the half for the Chargers, while Greenlaw was ejected from the game. 

Overall, Herbert went 21 for 35 for 196 yards with one touchdown and one interception. He was once again working without his top receiving options, as Mike Williams and Keenan Allen were out for this one. 

Carter was the top receiver with 64 yards on four receptions while Josh Palmer had three catches for 44 yards. On the ground, Austin Ekeler couldn’t get much going, with six carries for 24 yards. 

ADRIAN DINGLE, FORMER CHARGERS DEFENSIVE END AND CLEMSON STANDOUT, DEAD AT 45

For the Niners, Garoppolo was efficient, going 19 of 28 for 240 yards, and Brandon Aiyuk caught six of those passes for 84 yards to lead the team. In the run game, McCaffrey and Elijah Mitchell split carries, with the latter totaling 89 yards on 18 touches. McCaffrey had just 38 yards on 14 carries, but had four catches for 39 yards in the pass game. 

McCaffrey wasn’t the only one with a rushing touchdown, as Garoppolo got in on a quarterback sneak in the first half. 

Christian McCaffrey runs

Christian McCaffrey #23 of the San Francisco 49ers rushes during the third quarter against the Los Angeles Chargers at Levi's Stadium on Nov. 13, 2022 in Santa Clara, Calif.  (Ezra Shaw/Getty Images)

CLICK HERE TO GET THE FOX NEWS APP

Both teams own the same record heading into Week 11, and will be facing primetime slots. 

The Kansas City Chiefs head to SoFi Stadium to take on the Chargers next Sunday night, while the 49ers are the Monday night game against the Arizona Cardinals, an NFC West rival.