Ted Ginn Jr. picked up San Francisco's 17, in Jim Harbaugh's debut as an NFL head coach.
Seattle pulled within 19-17 with four minutes to go in regulation before Ginn returned a kickoff 102 yards for a score. He took a punt 55 yards to the end zone a short time later to seal the win.
"I didn't think they were going to come right back and punt it to me. I just tried to make them pay for it," Ginn said. "With the special teams that we have there's always a [chance] we can pop one."
David Akers connected on four short field goals and Alex Smith conservatively completed 15-of-20 passes for 124 yards for the 49ers (1-0), who plucked Harbaugh from Stanford following a 6-10 campaign last year.
Tarvaris Jackson threw an interception and lost two fumbles in his first start under center for the defending NFC West champion Seahawks (0-1).
The former Vikings signal-caller passed for 197 yards and two touchdowns, one coming on a short slant that Doug Baldwin turned upfield for a 55-yard score with 3:56 remaining, cutting Seattle's deficit to two.
Ginn stopped any change in momentum by fielding the ensuing kickoff two yards deep in the end zone. He made one defender miss around the 15-yard line and sprinted untouched up the right sideline for a back-breaking score.
The Seahawks went three-and-out, and Ginn took Jon Ryan's punt and broke several arm tackles en route to a 55-yard TD, locking up a season-opening win for the hosts.
"It's a very disappointing first game for us. ... It felt like we were right there to take this game over, and then it fell apart in the kicking game," Seahawks head coach Pete Carroll said.
Ginn's 31-yard punt return at the tail end of a punt-filled opening quarter set up Akers' 27-yard field goal early in the second frame.
Jackson lost a fumble four plays later, leading to Akers' 24-yarder, and San Francisco's free agent acquisition added a 31-yard kick with 2:40 left before halftime.
The 49ers extended the lead before the break, as Smith took one in from a yard out on a bootleg to the right for a 16-0 cushion.
Jackson hit Golden Tate for an eight-yard TD 4:40 into the third quarter, and Steven Hauschka and Akers exchanged field goals of 39 and 18 yards, respectively, early in the final stanza.
Ginn has six return touchdowns in his career -- three on punts and three on kickoffs...Akers signed with the 49ers as a free agent after a successful 12- year stint with the Philadelphia Eagles...Frank Gore was held to 59 yards on 22 rushes for the 49ers, who got two sacks apiece from Justin Smith and Parys Haralson...Baldwin ended with a game-high 83 yards on four catches...Seattle gained 182 of its 219 yards in the second half.