SAN FRANCISCO — Faced with a late deficit against a team that has emerged as a nemesis, with an icy wind sweeping Candlestick Park and a young quarterback stuck in low gear, the 49ers fell back upon a formula that has served them well for nearly a decade. They gave the ball to Frank Gore.

The 30-year-old halfback, battling an ankle injury since the 49ers' bye week at the end of October, took a handoff with about 4? minutes left in Sunday's game against the Seattle Seahawks, found a big hole to his left, cut back across the field and showed some retro speed on the way to a 51-yard gain.

From there, the game played out like the final pages of a 49ers-written script. Colin Kaepernick picked up a first down on a designed quarterback run. Placekicker Phil Dawson booted a 22-yard field goal with 26 seconds left to give San Francisco a 19-17 lead. And nickel corner Eric Wright intercepted Russell Wilson's desperation heave with nine seconds on the clock to ice the Niners' victory.

Gore's gain came on a simple off-tackle run, but a particular play that offensive coordinator Greg Roman had saved for the moment. Left guard Adam Snyder, an injury sub, kicked out on a defensive lineman and Gore did the rest.

"When I saw the hole I kind of knew that 29 (free safety Earl Thomas) was going — he's so fast to the ball, I knew he was going to overrun it," Gore said. "So I kind of set him outside and then broke him back in because he's so aggressive."

It wasn't just the yardage that made Gore's jaunt the decisive play. It was his savvy decision to slide to the turf as he neared the right sideline, as opposed to running out of bounds and stopping the clock. That made any comeback by the Seahawks a long shot.

The win couldn't have come at a better time for the 49ers, or against a more relevant foe.

It allowed the Niners to keep pace with potential playoff competitors like Philadelphia and Arizona. More important, it proved this team has the fortitude to beat the Seahawks, who were riding a seven-game win streak and coming off a dismantling of the high-powered Saints, and who entered Sunday with a three-game lead over San Francisco in the NFC West, at 11-1.

Sunday's contest wasn't the cleanest game ever played — the teams combined for 16 penalties and 155 yards on those infractions — but it was as tightly fought as everyone expected. And as punishing.

"It's a painful thing," 49ers safety Donte Whitner said, nodding to a cut on his left shoulder. "Look at these shoulders and these bruises. It was two physical teams that really want to win a championship."

The TV networks and the nation's sports fans have come to regard this as the best rivalry in the NFL. The head coaches don't particularly care for another. The athletes are known for their rough play. And the familiarity of playing the same division has bred plenty of contempt.

Asked whether he enjoys the rivalry, 49ers coach Jim Harbaugh said: "Enjoy it? That's not the word I would use. It feels like you go to the dentist chair, and 3? hours of getting root-canal work done. They're tough. These games are only for the tough."

The Seahawks roughed up the Niners 29-3 at Seattle in Week 2, but it was apparent early that this game would be much closer. Credit the 49ers defense, which never wavered. Coordinator Vic Fangio's unit held bullish running back Marshawn Lynch to a mediocre 72 yards on 20 carries, and kept Wilson, the dynamic young quarterback, in the pocket.

"When he starts to scramble, his guys understand what playground football is," Whitner said. "The guys that go deep come back for the ball. The guys that are short go deep. We did a good job of containing him today and we did a good job of taking away that playground football."

Wilson finished with 15 completions in 25 attempts, for 199 yards. He ran for just 2 yards.

Unfortunately for the 49ers, they spent most of the first half trading three points for seven. Three of their first four possessions ended in field goals by Phil Dawson (one of them set up by Kassim Osgood's blocked punt), including a 52-yarder that gave San Francisco a 9-7 lead midway through the second quarter.

Seattle countered with a 72-yard drive, Wilson finishing it with his only touchdown pass of the day, a 39-yard strike to rookie tight end Luke Willson made possible by cornerback Carlos Rogers' missed tackle.

Considering the Niners' inconsistency in the red zone this season, it was a disturbing trend. But they broke through just before halftime. Kaepernick led his offense on a crisp 2-minute drive (or 3:39 drive, to be precise). Boldin aided the march with a leaping catch, and Kaepernick finished it with a scoring strike to tight end Vernon Davis. It was the 49ers' first touchdown against Seattle in almost six quarters, and gave them a 16-14 lead going into the half.

That's the way it stood until deep into the fourth quarter, when Golden Tate's 38-yard punt return set up the Seahawks for Steven Hauschka's field goal, giving the visitors a 17-16 lead. It might have remained that way were it not for Gore's big run.

It was a memorable game, and it might not be the last these teams play this season. If the 49ers are to make another Super Bowl run, their road is likely to travel through Seattle, home of the NFC's top seed.

"If we keep doing our thing and they keep doing their thing, there's no question," Gore said. "They're a great team, we're a great team. Like I said, it's the fourth quarter (of the season) and we are trying to go the right direction, and that's going north."

<i>You can reach Staff Writer Phil Barber at 521-5263 or phil.barber@pressdemocrat.com.</i>