SANTA CLARA, Calif. (AP) — Geno Smith scampered past the tired San Francisco defense for the go-ahead score in the closing seconds and struck the iconic Stephen Curry "night night" pose.

Just when it looked as if Seattle's playoff hopes might be put to rest, Smith engineered a game-winning, and possibly season-saving, drive.

Smith capped the 80-yard drive with a 13-yard scramble with 12 seconds remaining, giving the Seahawks their second win in seven games with a 20-17 victory over the 49ers on Sunday.

“We knew what was at stake,” Smith said. “We’re trying to turn around our season. This is a step in the right direction.”

The Seahawks (5-5) won their first three games under first-year coach Mike Macdonald before dropping five of six — including a sixth straight loss to San Francisco (5-5) last month.

Loss number seven in a row to the 49ers seemed imminent after Seattle allowed a go-ahead score in the fourth quarter and then got stopped on a fourth-and-1 in San Francisco territory.

Seattle Seahawks v San Francisco 49ers
Getty Images
loading...

But the Seahawks defense got a stop and Smith did the rest, completing seven of eight passes for 54 yards on the game-winning drive before running it in against a depleted defense that sorely missed injured edge rusher Nick Bosa on the final drive.

“We just knew we had to go down and score,” running back Kenneth Walker III said. “A field goal wasn’t going to get it done.”

1460 ESPN logo
Get our free mobile app

The win moved Seattle into a three-way tie for second place in the NFC West with San Francisco and the Rams, a game behind Arizona. The Niners have lost three division games, blowing fourth-quarter leads in all of them after dropping games earlier this season to the Rams and Cardinals.

“We gave them a chance,” 49ers coach Kyle Shanahan. "I thought our defense played great all game until that last drive. We let them hang around and when you let people hang around, that’s what happens.”

San Francisco had taken a 17-13 lead when Brock Purdy threw a 30-yard touchdown pass to Jauan Jennings with 9:33 to play. The Niners looked to be in great shape for a comeback win after stopping Seattle on back-to-back plays for no gain from the 37 with the Seahawks needing only 1 yard for a first down.

Seattle Seahawks v San Francisco 49ers
Getty Images
loading...

But the 49ers couldn't run out the clock on offense and gave Smith and the Seahawks the chance at the comeback.

Smith finished 25 for 32 for 221 yards with one interception and the touchdown run. Jaxon Smith-Njigba had 10 catches for 110 yards and Walker scored on a 1-yard run for the Seahawks.

Purdy went 21 for 28 for 159 yards with a touchdown pass, a TD run and an interception. Jennings had 10 catches for 91 yards and a score and Christian McCaffrey gained 106 yards from scrimmage for San Francisco.

Seattle Seahawks v San Francisco 49ers
Getty Images
loading...

“We have to be better,” left tackle Trent Williams said. “We have to execute better. We have to put more than 17 points on the board if we want to win a divisional game.”

Both offenses struggled in the first half with the 49ers scoring only once on a 10-yard scramble by Purdy and the Seahawks settling for two long field goals by Jason Myers after Smith got sacked on third down on those drives.

Injuries

Seahawks: WR Laviska Shenault (oblique) left the game in the first quarter. … CB Dee Williams (ankle) also left the game with an injury.

49ers: Bosa left the game with a hip and oblique injury. He had been limited all week by a similar injury and then hurt the other side on a sack in the second half. … TE George Kittle (hamstring) missed the game after being listed as questionable. … LB Tatum Bethune (knee) left the game in the first quarter. … WR Jacob Cowing (concussion) left in the first half.

Up next

Seahawks: Host Arizona on Sunday.

49ers: Visit Green Bay on Sunday.

Seattle Seahawks v San Francisco 49ers
Getty Images
loading...

More From 1460 ESPN