The Rams started the game with a rapid pace as quarterback Austin Davis moved them downfield with a variety of plays, and he handed the ball off to Benny Cunningham on the goalline to run in for the one-yard score.
Jeff Fisher's side continued to thrive on offense as Tre Mason broke upfield on a huge run, which allowed Davis to use a play-action pass to foul the 49ers defense and hit Lance Kendricks in the endzone for a 22-yard touchdown.
San Francisco got themselves on the board in the second quarter when they took advantage of a partially blocked punt which set them up inside the Rams' half. The offense couldn't score seven, but Phil Dawson nailed a 54-yard field goal through the posts.
Seconds before the break, the 49ers dragged themselves right back into the match when Colin Kaepernick hit Brandon Lloyd on a deep go route and the receiver ran all the way in for an 80-yard touchdown.
In the second half, the visitors took the lead on their first drive as Kaepernick moved them the length of the field, before he evaded the rush in the pocket and lofted a pass into the hands of Anquan Boldin at the back of the endzone.
San Francisco upped the ante again on offense as Kaepernick continued his excellent game. The quarterback this time displayed his accuracy as he picked out Michael Crabtree on a slant route for a 32-yard score.
The Rams scored a field goal from Greg Zuerlein to give them a glimmer of hope late in the game, but that was extinguished when Dontae Johnson intercepted Davis and ran into the endzone to secure his side's victory.