Joe Montana passed for more than 300 yards for the fourth consecutive game, tying the National Football League record, and Jeff Moore scored three touchdowns, two on passes from Montana, to lead the San Francisco 49ers to a 30-24 victory over the Los Angeles Rams tonight.

The 49ers fell behind with 9:56 left when Vince Ferragamo, returning to an NFL starting lineup after a dismal one-year stint in Canada, engineered a touchdown drive to put the Rams ahead, 24-23.

But with 4:40 remaining, Moore swept around right end from the one-yard line for his third touchdown, ending a 53-yard drive and giving San Francisco the victory. The march was set up by Dana McLemore's 45-yard kickoff return and was kept going by Montana, who completed five of five passes for 45 yards.

Montana completed 26 of 37 passes for 305 yards, equalling the NFL record of four straight 300-yard passing games set by San Diego's Dan Fouts in 1979.

Los Angeles got the ball back for the final time with 1:57 left at its 10-yard line. On the first play, Fred Dean sacked Ferragamo on the one. After two incomplete passes, San Francisco cornerback Dwight Hicks picked off Ferragamo's fourth-down pass and the 49ers ran out the clock.