SAN FRANCISCO -- Quarterback Colin Kaepernick passed for 275 yards and a touchdown, wide receiver Anquan Boldin caught nine passes for 98 yards, and the San Francisco 49ers continued their playoff push with a 23-13 victory Sunday against the St. Louis Rams at Candlestick Park.
The 49ers (8-4) won their second consecutive game, snapped the Rams' two-game winning streak and beat St. Louis (5-7) for the second time this season.
Tight end Vernon Davis caught four passes for 82 yards and a touchdown for San Francisco, while Frank Gore rushed for 42 yards and a touchdown on 15 carries.
Wide receiver Michael Crabtree was in the starting lineup for the 49ers and made his 2013 debut after missing the first 11 games with a torn right Achilles tendon suffered in May. Crabtree, who led the 49ers with 85 catches for 1,105 yards and nine touchdowns last season, caught two passes for 68 yards, including a 60-yarder.
Boldin had his most productive game since catching 13 passes for 208 yards in a season-opening victory against Green Bay. He did most of his damage in the first half, catching six passes for 67 yards.
Kaepernick completed 19 of 28 passes and had a passer rating of 111.5.
Rams quarterback Kellen Clemens completed just 19 of 37 passes for 218 yards and a touchdown with one interception and a passer rating of 67.2. Rams running back Zac Stacy rushed for 72 yards on 19 carries.
St. Louis had won back-to-back games over the Colts and Bears by a combined score of 80-29, overpowering them on the ground. But the Rams' offense didn't hit its stride until it was too late Sunday against a 49ers defense that was ranked sixth in the NFL.
The 49ers built a 13-3 lead in a sloppy, penalty-filled first half, using two Phil Dawson field goals and running back Frank Gore's 3-yard touchdown run. The Rams were flagged seven times for 60 yards, and the 49ers six times for 60 yards in the opening half.
After spotting the 49ers a 13-0 lead, the Rams answered with two Greg Zuerlein field goals, a 43-yarder late in the first half and a 34-yarder midway through the third quarter, pulling to within seven points.
The 49ers responded with a 72-yard scoring drive that ended with Dawson's 24-yard field goal, extending their lead to 16-6.
After forcing a Rams punt, the 49ers appeared headed for another score when Kaepernick connected with Crabtree on a 60-yard throw. On second-and-10 from the 49ers' 17, Crabtree beat cornerback Trumaine Johnson on a stop-and-go move, grabbed Kaepernick's dart along the right sideline at the 35 and raced 42 more yards after the catch to the Rams' 20.
But on second-and-10 from the 20, linebacker Alec Ogletree forced Gore to fumble, and safety Rodney McLeod recovered at the Rams' 20.
After gaining just two yards on three plays, the Rams tried a fake punt that backfired. Jake McQuaid hiked the ball to up-back Matt Giordano, who was tackled by Anthony Dixon at the 17 for a 5-yard loss. It appeared as if Giorando wanted to pitch the ball to wide receiver Stedman Bailey on an end around, but Bailey wasn't open, and he had to keep the ball.
On first down, Kaepernick hit Davis on a quick slant, and he powered his way into the end zone, putting the 49ers ahead 23-6 remaining with 14:31 left to play.
Clemens threw a 3-yard touchdown pass to wide receiver Brian Quick with 18 seconds left, cutting San Francisco's lead to 23-13.
The 49ers entered the game without starting left guard Mike Iupati, who was sidelined for the second straight week with a knee injury. Then early in the first quarter, starting left tackle Joe Staley suffered a right knee injury and was quickly ruled out. Right guard Alex Boone moved to left tackle, and Joe Looney came off the bench to play right guard.
Rams center Scott Wells suffered an ankle injury and was ruled out early in the third quarter. Tim Barnes replaced Wells. Then late in the third quarter, starting left tackle Jake Long collided helmet-to-helmet with Stacy. He left the game with a head injury and didn't return.
NOTES: Starting OG Mike Iupati (knee) and CB Tarrell Brown (ribs) were among the 49ers' inactives and were sidelined for the second straight game. Tramaine Brock replaced Brown and Adam Synder replaced Iupati in the starting lineup. ... Niners DT Ray McDonald (ankle) returned to the starting lineup after missing two games. ... Rams starting CB Trumaine Johnson, OG Chris Williams and RB Zac Stacy passed their concussion tests and played against the 49ers.