The steady rain in the first half impacted both offenses. Stafford almost threw interceptions on the Rams’ first two third downs, the second bouncing off of 49ers safety Talanoa Hufanga’s chest. The next two third downs were less dangerous, but no more effective as the ball sailed wide of its targets. McVay said the slipperiness of the ball was impacting what plays he could call.

The Rams’ defense was up to the challenge of keeping the quicksand offense in the game. Defensive tackle Kobie Turner had two third-down tackles. Safety Cam Kurl broke up two passes to George Kittle.

They held San Francisco (6-8) to 20 yards rushing in the first half, and 191 total yards in the game, four days after giving up 42 points and 445 yards to the Bills. The Rams secondary broke up a season-high nine passes against the Niners, three by reserve Ahkello Witherspoon starting in place of the injured Cobie Durant.

“I thought Ahkello was awesome,” McVay said. “They always have the ability to respond. This is a young group that has demonstrated the ability to do that and that’s one of the things that I think has served this team well.”

The offense was able to piece together just enough drives to get into scoring range. Running back Kyren Williams matched his career-high of 29 carries, set against Buffalo, while gaining 108 yards. Once the balls dried out, Stafford was able to connect on several short passes to keep the sticks moving, as well as a 51-yard bomb to Puka Nacua.

And when they got in range, kicker Josh Karty, a Stanford grad back in the Bay Area for the first time as a pro, was true on all four of his field goal attempts, even one that was tapped by a 49er’s finger.

“One thing I’ve learned is that in the NFL, every kick counts,” Karty said. “It was kind of a max pressure of every kick matters in a low-scoring game like this, but honestly it’s getting to be clear to me that every kick is like that in the NFL.”

The 49ers were able to threaten as the Rams held a three-point lead late in the fourth. But quarterback Brock Purdy overthrew Jauan Jennings on a shot at the end zone, and veteran corner Darious Williams made the tumbling interception. The offense worked the clock all the way down to 18 seconds before Karty made his final kick.

A horse collar tackle on the ensuing kickoff moved San Francisco within a Hail Mary’s distance of the end zone. But defensive coordinator Chris Shula called a blitz on the final play, and linebacker Christian Rozeboom got home for the win-sealing sack.

So that’s how the Rams won their seventh game in nine tries since the bye. A win without a touchdown for the first time since 2016. With Cooper Kupp failing to make a catch in a game for the first time since 2019.

They did it with grit, with Stafford setting the example by refusing to slide, by picking up two first downs via sneak, by being game when McVay called a read option at the goal line.

“I think our team showed we can win football games anyway you want in about a four-day span,” Stafford said. “You gotta find ways to win the football game. You gotta be tough mentally and physically and we are that. ... They all count for one at this point and anyway you get them, we’ll take them.”

The Rams moved within a half-game of the Seattle Seahawks (8-5) for the lead in the NFC West, and with the season finale against Seattle looming, firmly control their own destiny.

But they also proved that, no matter the conditions on the field or the sky above, there’s still a way forward for these resilient Rams.

“They love football, they love preparing, they love the process,” McVay said. “We challenged our guys a few weeks back to really say ... ‘Let’s make sure that we bring everything that we’ve got every single day and when we look back on this no matter what happens, there’s no regrets.’ And I think our guys have done that since then.”