Jim Harbaugh's side were thrashed 26-3 at home by the defending Super Bowl champions on Sunday, but returned to winning ways thanks to a superb performance from running back Frank Gore.
Gore ran for 116 yards and also had 51 yards from five receptions as the 49ers (5-2) won 13-6 and took over sole possession of first place in the NFC West.
Alex Smith threw a 12-yard touchdown pass to tight end Delanie Walker late in the third quarter, the 49ers first TD in seven quarters.
However, Smith was just 14 of 23 overall for 140 yards in another sub-par performance.
NFC rushing leader Marshawn Lynch finished with 103 yards for Seattle (4-3), who were restricted to two field goals.