SANTA CLARA, Calif. (AP) As if the San Francisco 49ers needed any reminder about how Seattle has dominated this once fierce NFC West rivalry of late, Kyle Shanahan and his coaching staff spent the night before the game reminding the players with highlights from the Seahawks' 27-point blowout just two weeks ago.

Message delivered.

Robbie Gould kicked a 36-yard field goal with 3:06 left in overtime after San Francisco's defense delivered three straight stops against Russell Wilson and the Seahawks to help the 49ers snap a 10-game losing streak against Seattle with a 26-23 victory on Sunday.

''It (emotionally) touched a part of guys that needs to be touched sometimes,'' said cornerback Richard Sherman, who was on the winning side of nine of those games with Seattle before joining the 49ers this season.

''Sometimes you need to touch guys' pride. You need to have some pride. You're a grown man. They went out there and embarrassed you. How are you going to respond? We responded today.''

Nick Mullens threw for 275 yards and a touchdown to help the 49ers (4-10) win consecutive games for the first time this season. Richie James Jr. returned a kick 97 yards for a touchdown and Gould kicked four field goals to give San Francisco its first win in the rivalry since 2013 when Jim Harbaugh was still coach.

DeForest Buckner added two sacks against Wilson as the defense stepped up after being on the wrong side of a 43-16 beating just two weeks ago.

''We took it personally,'' Buckner said. ''They flat out embarrassed us two weeks ago. Everybody from top to bottom wasn't happy about it. We knew it would be a dog fight coming into this week. We just played them two weeks ago. It was a long two weeks for sure.''

The Seahawks (8-6) had their four-game winning streak snapped and missed a chance to clinch a playoff berth with the loss to the Niners.

Russell Wilson threw for 237 yards with two TD passes to Doug Baldwin and Chris Carson ran for 119 yards and a score for Seattle. But Wilson was unable to generate any points on his final three drives, leading to the loss.

''We kept ourselves in the game, but we shot ourselves in the foot a bunch of times,'' offensive lineman Duane Brown said. ''We had plenty of opportunity to take it over, but we set ourselves back. We have to find a way to fix it. It's not going to get any easier.''

Carson tied the game early in the fourth quarter when he scored on fourth-and-goal from the 1. He appeared to be stuffed at the line by D.J. Jones, but managed to get out of that tackle and then fight through another attempt by Elijah Lee before diving over the goal line for the score that made it 20-all.

The teams then traded field goals later in the fourth to set up the overtime.

The 49ers forced a punt on the opening drive thanks in part to a holding penalty on Ethan Pocic that wiped out a third-down conversion.

Mullens then drove San Francisco into position for the game-winning kick with help from a pass interference call against Shaquill Griffin and a 16-yard run by Jeff Wilson Jr.

Gould then made his kick in the wind and rain, to give 49ers a rare celebration in a rough season.

''I know how much this one means for Sherm and how much this means for our fans,'' Gould said. ''For us just to be able to get a win and have some positivity going to the end of the season with a lot of young guys will help us for next year.''

FLAG DAY

The Seahawks committed three personal fouls on one drive in the third quarter to help the 49ers move the ball into the red zone. But San Francisco had to settle for a field goal after Wilson Jr. committed a personal foul, tossing the ball in the face of a Seahawks defender.

Seattle finished with 14 penalties for 148 yards.

DOWN IT

Seattle rookie punter Michael Dickson downed consecutive punts at the San Francisco 1 and then 2-yard line in the first half. The Niners managed to score following the second kick with Mullens finding Garrett Celek on a 41-yard score. The 98-yard drive was the longest for San Francisco since a 99-yarder against Seattle in 2002.

TO THE HOUSE

James took a kickoff back 97 yards for a touchdown in the first quarter for San Francisco's first return touchdown on a kick or punt since Ted Ginn Jr. did it in the 2011 opener against the Seahawks. Seattle's 40-year-old kicker Sebastian Janikowski made only a half-hearted effort at a tackle as the last line of defense on the play.

It was a rough sequence for Janikowski, who also missed the extra point before the kickoff.

INJURIES

Seahawks: S Bradley McDougald (knee) left the game in the first half. ... OL Jordan Simmons (knee) left in the second half.

49ers: CB Ahkello Witherspoon (knee) left the game in the first half.

UP NEXT

Seahawks: Host Kansas City on Sunday night.

49ers: Host Chicago on Sunday.

---

More AP NFL: https://apnews.com/tag/NFL and https://twitter.com/AP-NFL

Copyright 2018 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.