ST. LOUIS — The tie-breaker goes to the St. Louis Rams.
Rookie kicker Greg Zuerlein's 54-yard field goal with 26 seconds left in overtime lifted the Rams over the 49ers 16-13 Sunday before 57,279 fans at the Edward Jones Dome.
Zuerlein also kicked a 53-yard field goal on the final play of the fourth quarter to send the two teams into overtime for the second time this season.
They played to a 24-24 tie less than a month ago in San Francisco.
"It's over, we finally won," Rams quarterback Sam Bradford said of what he was thinking as Zuerlein's game-winner split the uprights on the goal post. "It took 10 quarters, but we finally came out on top. It's a huge win for this team and this organization. It's just something for us to build on going into the future."
The Rams improved to 5-6-1. They're 4-0-1 in the NFC West and still in the hunt for a playoff spot with four games left to play.
"Usually at this point, we're the opposite of undefeated in the division," Rams defensive end Chris Long said. "I feel good for 'Jack' (running back Steven Jackson) and I feel good for everybody who has come here and put in the work and bought into what Coach Fisher is doing. We rallied around each other, and hey, we're in the thick of it."
The 49ers dropped to 8-3-1. They lost for the first time since dropping a 26-3 decision against the New York Giants on Oct. 13.
San Francisco kicker David Akers missed a potential game-winning 51-yard field in overtime. Akers also missed a 41-yard field goal in overtime in the last meeting between the two teams.
Unlike the last Rams-49ers clash, this one was more of a defensive tussle.
The Rams limited the 49ers to 208 passing yards and held running back Frank Gore to 58 rushing yards on 23 carries.
"Our defense did a great job of keeping us in the game today," Bradford said. "I saw them in the locker room before the game and just their attitude and the way they were acting -- they had their music on -- I got a sense that they were going to go out and play great today. That's exactly what they did."
Bradford completed 25 of 39 passes for 221 yards. His top target was rookie Chris Givens, who had a career-high 11 catches for 92 yards.
The Rams got the ball first in overtime, but ended up punting after a holding penalty on tight end Matthew Mulligan.
The 49ers punted back to the Rams, who gave up the ball on a shanked punt by rookie Johnny Hekker that traveled only 14 yards.
After Akers misfired on the 51-yarder, the Rams took over at their own 41.
Running back Steven Jackson carried five times on a six-play drive that set up Zuerlein's game-winner. Givens also had 6-yard catch on third-and-5 to keep the drive going.
After Jackson was stopped inches short of a first down on a third-and-3 run, the Rams ran the clock down to 30 seconds before sending Zuerlein and the field-goal unit out on the field.
"It felt good coming off my foot," Zuerlein said. "I always watch, though, just in case, and it went through."
Frank Gore's 1-yard touchdown run in the first quarter gave the 49ers a 7-0 lead.
Gore's TD run capped an 11-play, 60-yard drive that took 6 minutes, 33 seconds off the clock.
The Rams got in position for a 58-yard field-goal attempt by Zuerlein with 25 seconds left in the second quarter, but his kick was wide left.
Rams coach Jeff Fisher opted to go for it on fourth-and-1 from the San Francisco 4 in the third quarter, but Bradford's pass to Austin Pettis was incomplete in the back right corner of the end zone.
The Rams got on the scoreboard when San Francisco quarterback Colin Kaepernick was called for intentional grounding in the end zone, resulting in a safety with 4:27 left in the third quarter.
James Laurinaitis and Janoris Jenkins pressured Kaepernick into throwing the ball away.
The 49ers put together a drive that ended with a 23-yard field goal by Akers with 8:43 left.
The drive included a 15-yard penalty for roughing the passer on Robert Quinn. The extremely questionable call was shown repeatedly on the video scoreboard, triggering boos each time.
Trailing 10-2, the Rams tied the score after a 2-yard fumble return for a touchdown by Jenkins with 3:04 left in the fourth quarter.
Kaepernick attempted to make a long pitch to wide receiver Ted Ginn Jr. on a third-and-3 play. The ball went over Ginn's head.
Jenkins fell on the ball at the San Francisco 2, rolled over and ran into the end zone for his third touchdown in the Rams' last two games.
Left tackle Rodger Saffold was called a false start on the 2-point conversion, moving the ball back to the San Francisco 7.
San Francisco's Aldon Smith appeared to jump offsides, causing Saffold to move.
"When I saw him coming off the ball, my big thing is that I wanted to keep Sam clean," Saffold said. "Whether he was wrong or not, I knew that he was going to be coming, so I wanted to make sure I was between him and my quarterback."
Bradford threw a 7-yard pass to tight end Lance Kendricks to get Saffold off the hook.
"That was another one where I almost dropped to my knees and thanked the Lord," Saffold said.
The 49ers got the ball back and Kaepernick, who had nine carries for 84 yards, broke loose for a 50-yard run.
The big gain led to a 33-yard field goal by San Francisco's David Akers with 1:34 left.
With the help of a 15-yard penalty on San Francisco safety Dashon Goldstein for a late hit on Bradford after he'd slid to the ground on a run, they moved down the field for Zuerlein's game-tying field goal.
Contact reporter Steve Korte at firstname.lastname@example.org or 239-2522.