In a bruising clash of two defence-minded teams, the 49ers scored the only touchdown of the night through tight-end Delanie Walker in the third quarter then held off the Seahawks in the final period.
San Francisco quarterback Alex Smith, who was sacked six times and threw three interceptions against the Giants on Sunday, completed 14 of 23 passes for 140 yards, one touchdown and one interception.
Having trailed 6-3 at half-time, the 49ers roared back to improve their season record to 5-2 after starting the game joint top of the NFC West with Seattle and the Arizona Cardinals.
San Francisco running-back Frank Gore rushed for a game-high 131 yards against one of the top defences in the National Football League to set a defiant tone for his team.
Rookie quarterback Russell Wilson threw for just 122 yards and one interception as the surprising Seahawks slipped to 4-3 in front of a highly energised crowd at San Francisco's Candlestick Park.
"That was a sweet win, that was a sweet victory right there," San Francisco coach Jim Harbaugh shouted in delight to his team afterwards in their locker room.
"That's the most physical 30 minutes I have ever seen you guys play right there," he said, referring to their comeback after half-time. "That was beautiful."
The Seahawks, fresh from their 24-23 upset over the New England Patriots on Sunday, made a strong start and Steven Hauschka put them 3-0 up with a 52-yard field goal.
However, stingy defence by both teams dominated a low-scoring opening quarter which ended at 3-3 after San Francisco kicker David Akers landed a field goal from 38 yards.
Hauschka converted from 35 yards early in the second period after an eight-play drive to put the Seahawks ahead 6-3, but he later missed another attempt from 51 yards.
Seattle continued to produce greater threat in offense, especially through the bullocking rushing of running-back Marshawn Lynch, but there was no further score before half-time.
The 49ers went ahead for the first time with just under five minutes left in the third quarter when Walker capped a 10-play drive by powering into the endzone in the left corner for a 12-yard touchdown.
A 28-yard field goal by Akers late in the final quarter gave the 49ers a 13-6 lead and there was no way back from there for the Seahawks against a water-tight defence.