Updated

SANTA CLARA, Calif. (AP) Jared Goff threw for 292 yards and three touchdowns and Todd Gurley ran for two TDs and caught another to help the Los Angeles Rams put up another big offensive performance with a 41-39 victory over the San Francisco 49ers on Thursday night.

The NFLs lowest-scoring team last year looks like a completely different outfit this season under first-year coach Sean McVay thanks to vastly improved play by Goff after a rough rookie season as the No. 1 overall pick.

The Rams (2-1) have also been helped by the additions of receivers Sammy Watkins and Robert Woods and the play-calling of McVay as they have scored 107 points through three games. Thats the second-most in franchise history, trailing only the 119 by The Greatest Show on Turf squad in 2000.

This win didnt come easy as the Rams nearly blew a 15-point lead, giving up two late touchdowns, fumbling a kickoff return and failing to recover an onside kick. But Los Angeles managed to stop a potential game-tying 2-point conversion and then used an offensive pass interference penalty against Trent Taylor and a fourth-down sack by Aaron Donald to stop the Niners after the onside kick.

The 49ers (0-3) scored five touchdowns after failing to get any the first two weeks but still came up short in part because a missed extra point by Robbie Gould forced them to try for 2 on their late touchdown.

This time it was a tired defense that hurt San Francisco. After facing 79 plays in a 12-9 loss at Seattle on Sunday, the 49ers appeared to run out of gas on the short week as Goff frequently had wide-open receivers, especially on third down.

All three of Goffs touchdown passes came on third down, including a 13-yard pass to Watkins early in the fourth quarter that gave Los Angeles a 41-26 lead.

The Rams needed all that offense on a night where Brian Hoyer threw for 332 yards and two touchdowns and ran for another score.