"We know the talent we have on this team," Kaepernick said. "We know what we're capable of."
Anquan Boldin had five catches for 90 yards and a touchdown, and Gore had 153 yards on 20 carries and a 34-yard score for San Francisco (2-2), which was outscored 56-10 the previous two games. NaVorro Bowman had two of the 49ers' five sacks with a strip leading to Anthony Dixon's fourth-quarter scoring run.
"If we keep playing, our offense will come around sooner or later," Bowman said.
The Rams (1-3) had an overtime win and a tie against San Francisco last year, and took the early lead Thursday before falling flat. Greg Zuerlein banged in a 40-yard field goal off the right upright to end a nine-game scoring drought in the first quarter, but the 49ers answered with 28 straight points.
"Tomorrow's going to be a pretty tough day in the film room," Rams quarterback Sam Bradford said. "The good news is we have 10 days, 11 days until we play again and there's going to be ample time to get that corrected."
St. Louis was held to 188 total yards and was completely stuffed on the run, with 18 yards on 19 carries.
"That's what we do," said safety Donte Whitner, who had an interception in the end zone. "We stop the run first, then we stop the pass and then we get away with wins."
The 49ers came close to a Super Bowl title in February and regained their footing against the team that gave them the most trouble last season. Minus cornerback Nnamdi Asomugha and linebackers Patrick Willis and Aldon Smith, they quieted a raucous, hopeful crowd, sending all but a few thousand home early.
"We're going to have to get tough in here," Rams defensive end Chris Long said. "We're going to have to hold each other accountable and make plays and dig our way out of this hole because nobody's going to do that for us."
Kaepernick had no touchdown passes and four interceptions the previous two weeks and completed fewer than 50 percent of his passes. He was 15 for 23 for 167 yards.
Boldin had a monster debut with the 49ers after helping the Ravens beat San Francisco in the Super Bowl, but had been quiet along with the rest of the offense the previous two weeks. He had two highlight catches in the second quarter, a 42-yarder despite Cortland Finnegan getting flagged for holding, and a 20-yard score capped by a dive into the end zone after barely avoiding the sideline.
Gore more than doubled his output from the first three weeks and got a lot more work, too, after totaling just 11 carries last week. Four days earlier, DeMarco Murray burned them for 175 yards in Dallas' 31-7 win.
"It's disgusting," Long said. "It really is just disgusting."
The Rams have trailed by double digits in every game, making up an 11-point deficit against Arizona in the opener but not gaps of 21 and 24 points against Atlanta and Dallas, and were down by 25 in the fourth quarter against San Francisco.
They got hit by injuries, too, the worst of them when rookie safety T.J. McDonald was carted off with a leg injury in the second half.
Bradford was 19 for 41 for 202 yards and an interception and has been sacked 11 times the last two games after the Rams allowed none the previous four games.
After mustering just 25 yards in the first quarter, the 49ers took a noisy crowd out of it in the second, averaging more than 11 yards per snap while piling up 176 yards and two touchdowns. Kaepernick was 8 for 12 for 104 yards in the half, all but 11 of those yards in the second quarter.
The Rams went for it on third-and-1 from the 49ers 34 and Whitner's diving interception on a tipped ball in the end zone set up an eight-play, 80-yard drive capped by Gore's 34-yard run on third-and-1 in the final minute that made it 14-3.
The San Francisco defense took Gore off the hook for getting stripped by rookie Alec Ogletree and a turnover, forcing St. Louis into a three-and-out. Davis, who had been questionable with a because of a hamstring injury, broke open for an easy catch in the left side of the end zone to push the lead to 21-3.
Paul Salata, creator of Mr. Irrelevant Award, dies at 94
Paul Salata, who created the Mr. Irrelevant Award that honors the last selection of the NFL draft after playing football at USC and in the NFL and Canadian Football League, died Saturday. He was 94.
Las Vegas Raiders activate Marcus Mariota off injured reserve in time for road date vs. Denver Broncos
After his "good week of practice," the Las Vegas Raiders activated backup quarterback Marcus Mariota off injured reserve on Saturday, as interim coach Rich Bisaccia hinted on Friday in anticipation of Sunday's game in Denver.
NFL 'right where we need to be' in crackdown on taunting penalties
NFL Officials threw 11 flags for taunting in the first two weeks of this season -- the same number called in the entire 2020 season for the same foul -- but only three over the next three weeks.
David Baker retires as president of Pro Football Hall of Fame
David Baker, president and executive director of the Pro Football Hall of Fame, announced his retirement on Saturday.
Indianapolis Colts WR T.Y. Hilton activated from IR, to make season debut Sunday vs. Houston Texans
Colts wideout T.Y. Hilton has been activated from the injured reserve list and will make his season debut Sunday against the Texans.
Carolina Panthers place RB Christian McCaffrey on injured reserve
Panthers running back Christan McCaffrey can't return until Week 9 at the earliest after he was placed on injured reserve. McCaffrey had already missed two games with a hamstring injury.