Updated Monday, December 17, 2012 at 03:02 PM
FOXBOROUGH, Mass. — The San Francisco 49ers turned a nearly historic collapse into a stunning victory and a playoff berth.
San Francisco withstood a 28-point comeback by the New England Patriots to win 41-34 on Sunday night in the rain.
Michael Crabtree took a short pass from Colin Kaepernick and sped around cornerback Kyle Arrington for a 38-yard touchdown with 6:25 to go, then David Akers made a 28-yard field goal to clinch it.
The 49ers (10-3-1) own at least a wild-card spot and play at Seattle on Sunday with a chance to win the NFC West. A loss would bring the division race down to the final weekend.
Kaepernick threw for four touchdowns, two to Crabtree, who had 107 yards receiving. The defense rattled Tom Brady at times, but also yielded 443 yards passing in a sloppy contest between two of the league's more precise teams.
"We just spotted them 28 points," Brady said. "We fought hard, but you can't play poorly against a good team and expect to win. We can't miss plays that we have opportunities with."
AFC East champion New England (10-4), which had won seven in a row, trailed 31-3 in the third quarter and lost for the first time at home in December in 21 games, dating to 2002.
San Francisco forced four turnovers, matching the number of giveaways New England had at home all season.
• The Patriots silenced their "End Zone Militia" by taking the muskets away from the Revolutionary War re-enactors who fire into the air to celebrate every score.
Two days after 20 children and six adults were shot to death at the Sandy Hook Elementary School in Newtown, Conn., stadiums fell silent before games to honor the victims' memory. Some of the team's wore helmet decals or black ribbons.
After learning that he was the favorite player of one 6-year-old victim, New York Giants receiver Victor Cruz wrote "R.I.P. Jack Pinto," "Jack Pinto, my hero" and "This one is for you" on his shoes.
JARED WICKERHAM / GETTY IMAGES
Frank Gore celebrates after scoring a touchdown against New England in a key road victory for San Francisco.