ST. LOUIS — To earn a week off, the San Francisco 49ers' defense had to step up.
The 49ers wrapped up the No. 2 playoff seed in the NFC and a first-round bye with a closer than expected 34-27 victory over the St. Louis Rams on Sunday. The Rams, offensively challenged all season, made it interesting with 17 points in the fourth quarter with two touchdowns in a span of 13 seconds.
"I think we kind of got a little relaxed and didn't play the type of defense we're supposed to play, and that's what happened," 49ers linebacker Patrick Willis said. "Anytime you don't play the way you're supposed to play it can turn on you in a matter of seconds."
The Rams (2-14) gained 311 yards behind third-string quarterback Kellen Clemens, a huge improvement from five weeks earlier when they were held to 157 yards in the 49ers' 26-0 victory to clinch the NFC West. They have the second pick of the draft, their fourth top-two pick in five seasons.
Tarell Brown had a pair of interceptions that led to touchdowns, but had a late interference call in the end zone to set up a 1-yard run by Cadillac Williams that cut the deficit to seven.
"Give credit where it's due, they made plays when they needed them," Willis said. "We had enough good plays to win and that's all that matters."
Now they get a shot at getting healthy. Wide receivers Ted Ginn Jr. (ankle) and Kyle Williams (concussion) were inactive and running back Frank Gore sat out the second half Sunday, although he insisted he was fine.
"We needed it, we needed it really bad, we needed it very bad," coach Jim Harbaugh said. "You plug in whatever you want, OK?"
Rams coach Steve Spagnuolo fell to 10-38 over three seasons and may have coached his last game, but appeared optimistic. Owner Stan Kroenke did not attend the finale of a season that was a total bust, accelerated by injuries in the second half, after the franchise made a six-win improvement last season.
"Obviously, the results are not what we wanted. There were some things we couldn't control, other things we could," Spagnuolo said. "We certainly think we should be better than 2-14, but I do think there was tremendous growth.
"You grow more in a situation like this than you do when it's all going easy."
The 49ers made a seven-win improvement and their record is their best since another 13-win season in 1997 under another rookie coach, Steve Mariucci.
Michael Crabtree caught touchdown passes from Alex Smith and kicker David Akers on a fake field goal, and Vernon Davis topped 100 yards receiving for the second time this season as the 49ers overcame their shortage of pass catchers.
Crabtree fooled defenders on Akers' first career touchdown pass, pretending to leave the field but stopping just shy of the sideline. He was not covered on an easy 13-yard score that made it 27-10 late in the third quarter.
"You've got to not give it away and back up and make it look like we're going to attempt the kick," Akers said. "I looked over and Crab was wide open, and it was like 'Oh my.'"
Akers broke the NFL single-season field goal record last week and finished with 44, including five in the first half of the two St. Louis meetings. He missed on a 48-yarder, but clicked from 36 and 42 yards.
The Rams closed the gap quickly on Brandon Lloyd's 36-yard touchdown catch, a successful on-side kick and Williams' scoring run with 4:39 to go one play after Brown interfered with Lloyd.
Kellen injured his right ankle on a sack by NaVorro Bowman with 2:46 to go, forcing the Rams to go with untested Tom Brandstater on third-and-17 from the 49ers 40. Brandstater threw two incompletions, the 49ers took over at their own 40 and needed just one first down to seal it.
The 49ers finished 6-2 on the road, the franchise's best showing since 1996. Harbaugh is just the fourth rookie head coach to win 13 games and third by the 49ers, topped by George Seifert's 14-2 showing in 1989.
Clemens, whose 18-yard scramble gave the Rams the early lead, made his third straight start in place of Sam Bradford (high left ankle sprain) and A.J. Feeley (broken right thumb). Bradford, the top pick in 2010, missed his fourth straight game and sixth overall.
Steven Jackson had 76 yards on 16 carries before injuring his left biceps in the third quarter, a huge improvement over the first meeting against the 49ers in early December when he was held to 19 yards on 10 carries.
Notes: Missouri's Gary Pinkel, who coached the 49ers' Aldon Smith and the Rams' Danario Alexander, was on the sideline before the game. ... 49ers FB Bruce Miller (left knee) was sidelined in the second quarter, but was in uniform testing it with sprints before halftime. ... Clemens said X-rays were negative.
Copyright 2016, Deseret News Publishing Company