LOS ANGELES (AP) The Los Angeles Rams ran the ball on their first seven consecutive plays, marching straight through San Francisco's defense for 65 yards and a touchdown.
''That definitely hits you on a personal level,'' 49ers defensive tackle DeForest Buckner said. ''I'm pretty sure a lot of guys took it personally.''
The Niners' defense vowed to spend the rest of a memorable Sunday making up for that embarrassment. And with a fourth-down stop on the goal line several minutes later, San Francisco completely changed the direction of this NFC West rivalry.
Jimmy Garoppolo passed for 243 yards and ran for a touchdown, and San Francisco remained unbeaten with a dominant defensive performance in a 20-7 victory over the struggling Rams.
George Kittle had eight catches for 103 yards for the Niners (5-0), but their tenacious defense did most of the work. San Francisco held Los Angeles' once-unstoppable offense to 157 yards in coach Kyle Shanahan's first victory over Rams coach Sean McVay in a game in which both California rivals were playing their starters.
''LA has gotten after us a lot the last couple of years, so it was a game for us to come out here and just show that we are back and for real,'' Niners defensive lineman Solomon Thomas said.
These rivals are going in opposite directions after this one-sided showdown at the Coliseum. San Francisco stayed alongside New England as the NFL's only unbeaten teams, while the Rams (3-3) are on their first three-game losing streak of McVay's 2 1/2-year tenure.
After enduring two miserable seasons while the Rams reached Super Bowl heights, the Niners were eager to reassert themselves in this classic NFL rivalry.
San Francisco won a defense-dominated game by thoroughly throttling the defending NFC champions' once-impressive passing game. Jared Goff went 13 of 24 for a career-low 78 yards while failing to get comfortable behind a porous offensive line, and the Rams didn't manage a completion longer than 12 yards while going 0 for 9 on third down and 0 for 4 on fourth down.
''We were running the ball so well early, and we were trying to stick with that,'' Goff said. ''We just never really got in a rhythm. Their defense was able to settle in, and that's part of it.''
The game was still up for grabs when the Rams reached the San Francisco 1 on third down shortly before halftime, but the Niners smothered two straight running plays up the middle.
''It sparks everybody,'' Garoppolo said. ''Coaches, players, everybody is hollering on the sideline.''
Tevin Coleman rushed for an early touchdown for San Francisco, while Garoppolo was mostly effective despite two turnovers. The Niners didn't score a touchdown in the final 27 minutes, but they're off to their fourth 5-0 start in franchise history, and their first since 1990.
With Todd Gurley sitting out to rest his bruised thigh, Los Angeles couldn't move the ball in its least productive performance of McVay's tenure.
Robert Woods rushed for a touchdown on the opening drive for the Rams, who then managed 48 net yards on their next seven drives combined.
''We came out and started fast, but it comes back to consistency,'' Woods said. ''We look like a good offense sometimes, (and then) we look like a bad offense. We're just not being consistent.''
The Niners' offense wasn't significantly better during a first half in which both teams turned the ball over at the opponents' 1, but San Francisco capitalized on Rams rookie Darrell Henderson's fumble on the opening snap of the second half for a short go-ahead TD drive capped by Garoppolo's sneak.
San Francisco then took control, moving the ball deliberately and thoroughly shutting down the Rams. Garoppolo's fumble was returned to the San Francisco 36 with 8:40 to play, but the Rams promptly turned it over on downs.
''After that, I had a feeling that if we just don't turn it over, we'll win this game,'' Shanahan said. ''I haven't had that feeling very much in my career, and the defense definitely gave it to me the whole game.''
San Francisco answered the Rams' opening TD drive with Coleman's TD run capping a 75-yard drive. The Niners drove to the Rams 1 again, but Garoppolo's atrocious throw at the goal line was easily intercepted by Marcus Peters.
Henderson, a third-round pick with one career carry before this game, dropped a pitchout from Goff on the opening play of the second half, and Arik Armstead recovered at the Rams 17. San Francisco easily scored on the short field.
49ers: They played without both of their starting offensive tackles, Mike McGlinchey and Joe Staley. ... CB Richard Sherman left the game with a stinger in the second half, but was OK.
Rams: LG Joe Noteboom was taken to the locker room on a cart during the first quarter after he injured his right knee. The second-year pro didn't return. ... S John Johnson was ruled out with an injured shoulder in the second half. ... Gurley missed his first game of the season, as did LB Clay Matthews, their sacks leader. CB Aqib Talib sat out with bruised ribs.
49ers: Visit the Washington Redskins on Sunday.
Rams: Visit the Atlanta Falcons on Sunday.
More AP NFL: https://apnews.com/NFL and https://twitter.com/AP-NFL