SANTA CLARA, Calif. (AP) -- Colin Kaepernick went down once, then again and another time.
Pressured from every direction by San Diego's defense, the quarterback had limited good looks before turning the game over to backup Blaine Gabbert.
The 49ers' offense still looks shaky two weeks from the regular season, and it did just enough for the team's first preseason victory in a 21-7 win against the Chargers on Sunday. The offensive line showed vulnerabilities all day.
''We've got to work on that. We've got to be good in that area,'' coach Jim Harbaugh said. ''I thought our precision was better offensively, defensively and on special teams - productive plays, execution.''
There were tens of thousands of empty seats hours after an overnight 6.0-magnitude earthquake struck in the Northern California wine country near Napa. The quake affected some public transportation options to the new $1.2 billion stadium, which was sold out last Sunday.
The patchy field is still hardly ideal, with visible lines where new sod was placed Friday after the initial turf failed to hold.
Phil Dawson kicked a 39-yard field goal at the 9:27 mark of the second quarter, ending an eight-quarter scoreless drought for the 49ers as they doubled their preseason total. Dawson added another from 28 yards a week after missing twice.
Dawson didn't get on the field until Sunday morning.
''I'm just amazed that was playable,'' Dawson said. ''It was an improvement, so hats off to those guys who worked so hard to get it in. Fortunately I missed two last week so my focus was solely on trying to make a field goal, so I didn't have enough room in my brain to worry about the field.''
Gabbert threw a 6-yard touchdown pass to Vance McDonald late in the first half for the 49ers' first TD of the preseason. That capped a drive in which Gabbert went 5 for 6.
Philip Rivers completed his first five passes and finished 9 of 10 for 85 yards and a touchdown. Kaepernick was 6 of 12 for 59 yards.
With Rivers' outing and Peyton Manning's 12-of-14 performance in a 34-0 rout last Sunday, the new-look 49ers secondary allowed the past two starting quarterbacks to complete 21 of 24 passes for 187 yards and passer ratings of 120 or better.
''We all haven't really come together yet,'' cornerback Tramaine Brock said. ''There's still a lot to learn.''
San Francisco's offensive line had major problems protecting Kaepernick, who was hit hard four times in three first-quarter series.
Right guard Alex Boone has held out all offseason in hopes of a new contract with two years remaining on his previous deal, and he might now have some increased leverage.
Kaepernick lost a fumble when he got stripped and pounded by Corey Liuget, who beat left guard Mike Iupati. But the Chargers failed to score when Ryan Mathews was stuffed on fourth-and-1 from the 5 by Michael Wilhoite.
Kaepernick was hit again on his next pass attempt, then a fourth time during his third series.
An illegal block nullified Rivers' 25-yard touchdown pass to Mathews in the final minute of the first quarter. But Rivers connected on a 10-yard TD pass to Antonio Gates on the next play.
The Chargers outgained San Francisco 121-17 in the first quarter - but not without a cost.
Defensive tackle Kwame Geathers went down with a knee injury at the 7:09 mark in the first quarter, while center Nick Hardwick suffered a first-half neck injury.
49ers fullback Will Tukuafu sustained a concussion, while rookie third-round draft pick center Marcus Martin was carted off with 11:18 remaining with a knee injury.
San Francisco's Glenn Winston ran for a 27-yard touchdown in the fourth quarter against a Chargers defense that allowed five TDs rushing in a 41-14 loss to the Super Bowl champion Seattle Seahawks.
''We had something to prove after last week. We really put a focus on stopping the run, and I thought we did a good job,'' linebacker Donald Butler said. ''It's good that when you put a focus on something, that you're able to go out there and do it.''
Kaepernick and Anquan Boldin spent extensive time testing their footing, working on routes and communicating during warmups on the new grass, which still featured divots and holes and isn't a permanent solution.
The 49ers have won the past five preseason meetings between the teams, who have faced off in the exhibition schedule every year since 1987. Neither showed much given they play here again in Week 16 on Dec. 20.
Craig Dahl started at safety for the 49ers in place of Antoine Bethea, held out as a precaution after last Sunday's concussion. Linebacker Patrick Willis made his first appearance of the preseason.
''Our biggest thing is we don't want to give them anything,'' Willis said.
AP NFL website: www.pro32.ap.org and www.twitter.com/AP-NFL