SAN FRANCISCO -- Not only is Alex Smith playing for a job next season, he might be helping coach Mike Singletary save his.
A switch of quarterbacks named Smith did wonders to keep San Francisco's hopes alive.
Alex Smith threw for 255 yards and three touchdowns in a triumphant return to the starting lineup following a five-game absence, and the 49ers improved their once-slim playoff chances with a 40-21 victory over the NFC West rival Seattle Seahawks on Sunday.
The Niners muddled up the ugly West race even more with a surprisingly lopsided win.
San Francisco (5-8) moved within a game of division leaders Seattle (6-7) and St. Louis (6-7), which lost 31-13 at New Orleans.
The 49ers looked much more like the team that was predicted to win the division after an unbeaten preseason -- not the bunch that began 0-5.
"We're a young team and today was big for us," Singletary said. "But at the same time, today means nothing if we don't play well next week. We have very little room for error, and we have to understand that."
Matt Hasselbeck went 27 for 42 for 285 yards and two TDs, but threw four interceptions and lost a fumble as Seattle had turnovers in five of six possessions during one stretch.
"They didn't have to do anything special today because we gave them so many good shots and good opportunities," Seahawks coach Pete Carroll said.
Vernon Davis caught five passes for 70 yards and a 42-yard catch-and-run TD, Josh Morgan made a 15-yard touchdown reception and Brian Westbrook hauled in a 62-yard touchdown pass for his longest career TD catch and longest play from scrimmage since 2006. Westbrook wound up with six catches for 87 yards.
"It's playoff mode right now," Smith said. "It was a must-win game. We knew that all week -- our backs against the wall."
Smith matched a career high by throwing for three touchdowns for the fifth time. The No. 1 overall draft pick in 2005 was back behind center in place of Troy Smith, who went 3-2 during his stint as San Francisco's starter.
Dashon Goldson made a 39-yard interception return for a touchdown on the third play of the second half.
This was a far cry from the rivals' matchup in Week 1, when the Seahawks won 30-6 and San Francisco failed to reach the end zone. Singletary thanked Carroll afterward for the whipping.
Jeff Reed kicked four field goals Sunday for the 49ers, who had already reached their season high in points by halftime with a 30-7 lead. It was the Niners' biggest first half since scoring 35 in a 35-16 home win over the Rams on Nov. 16, 2008.
Leon Washington returned a kickoff 92 yards for a touchdown late in the third quarter -- the highlight of the day for the Seahawks, who lost for the fifth time in seven games after a 4-2 start.
"This one's pretty bad," Hasselbeck said. "It was not a good day for us. It was not a good day for me. It seems like everything was going wrong."
Deon Butler caught a late 2-yard touchdown and seriously injured his right leg. It appeared Butler broke his leg moments after he caught a 2-yard touchdown pass upon being hit by Phillip Adams. This is another tough blow for the Seahawks, who already were playing without top receivers Mike Williams and Ben Obomanu.
Medical personnel placed a vacuum splint on Butler's lower leg before taking him for an X-ray. He was quickly transported to Stanford Hospital, where he could spend several days.
San Francisco is trying to avoid missing the playoffs for the eighth straight season, but realizes it still has an uphill climb to get there.
The 49ers have a quick turnaround to play at San Diego on Thursday night.
Singletary will stick with Alex Smith, who hadn't played since separating his non-throwing left shoulder Oct. 24 at Carolina -- though the coach has said his starter will be determined on a week-to-week basis. Alex Smith has experience running this offense and allows the 49ers to utilize their entire playbook.
He was booed after their first play from scrimmage, an incomplete pass intended for Delanie Walker -- then again moments later after another incompletion. Smith heard it all, then hit Davis on a 22-yard gain and then the touchdown three plays later for a 7-0 lead.
"I looked at Alex and I just started smiling," Davis said. "He's one of those guys that it doesn't really matter what people do. He's going to come out and do his best every time."
Seattle tied the game on its second offensive series, when Hasselbeck found a wide-open Ruvell Martin for an 11-yard TD.
Reed's 33-yard field goal as the first quarter ended barely cleared the crossbar for a 10-7 lead, then he kicked a 44-yarder at the 10:31 mark of the second quarter. His other two went 22 and 36 yards.
Takeo Spikes intercepted a pass by Hasselbeck on the Seahawks' opening drive of the second quarter, coming down with the ball after fellow linebacker Manny Lawson tipped it off Michael Robinson's hands.
Hasselbeck, who completed seven of his initial eight throws, is still one victory from tying Dave Krieg as Seattle's winningest quarterback. Krieg won 70 games from 1981-90.
49ers LB Travis LaBoy had a sack, forced fumble and fumble recovery on one play for the 49ers in the second quarter. ... 49ers S Reggie Smith made his first career interception. ... San Francisco's defense hasn't allowed a 100-yard rusher in 19 straight games, the second longest active streak behind Jets' 20.
The 25 semifinalists for the Pro Football Hall of Fame include Brett Favre, Terrell Owens and Alan Faneca, all of whom are in their first year of eligibility.
The Around the Horn panel react to ESPN's Chris Mortensen's report that the Seahawks are concerned Russell Wilson has become a "celebrity QB," thanks to his current girlfriend and recording artist Ciara.
The Arizona Cardinals' drop from No. 3 to No. 4 in the ESPN NFL Power Rankings despite beating 8-2 Cincinnati makes little sense to Josh Weinfuss.
Here's a closer look at whom the Philadelphia 76ers are on the brink of joining in the annals of futility -- the teams with the longest major pro and college losing streaks.
The Eagles released linebacker Emmanuel Acho to clear a spot for wide receiver Jonathan Krause on the active roster.
Gary Kubiak said he's ready for the stream of questions that's to come surrounding Peyton Manning, Brock Osweiler and Denver's starting quarterback.