SANTA CLARA >> As the Detroit Lions wrapped up their 40-34 win over the 49ers on Monday Night Football, an unmistakable chant rang out at Levi’s Stadium.

“JA-RED GOFF! JA-RED GOFF!”

It wasn’t so long ago that Goff couldn’t solve the 49ers. Entering Monday, he hadn’t beaten San Francisco since 2018, losing six consecutive games as a member of the Los Angeles Rams and Lions.

After Monday night, those memories are long gone. Goff got his revenge in Santa Clara, completing 26 of 34 passes for 303 yards and three touchdowns as the Lions took down the 49ers thanks to a prolific offensive display by their signal-caller.

“Pretty surreal,” said Goff, a Novato native who prepped at Marin Catholic and played college football at Cal. “Our fans have been unbelievable all year at road games. It’s truly remarkable what they’ve done. It’s loud on third down sometimes for the offense. It’s pretty cool. But yeah, it’s very cool for me, being home in front of my family and friends. Having an experience like that is cool.”

Not so long ago, Goff was the red-headed quarterback stepchild of the NFL, rejected by Sean McVay in Los Angeles in favor of veteran Matthew Stafford and banished to Detroit as damaged goods. Since then, he’s authored a stunning plot twist in his story.

Goff is now indisputably one of the best quarterbacks in the league, and one of the clearest reasons the Lions are Super Bowl contenders.

“I know he had a lot of friends and family here,” Lions coach Dan Campbell said. “So I know in that regard, that meant something. There was a lot that meant something to him. To be able to get a win out here when we didn’t last year. And then the previous history with the Rams.

“But this is a different Jared Goff now. He’s different. This guy has developed and matured, and he’s just stepping into his prime, and he continues to get better and better. He’s playing at an ultimate level right now. Find me a quarterback that’s playing better than him in this league right now. I’d love to see it.”

Just last season, Goff and the Lions came to the Bay Area for the NFC championship game and blew a 24-7 halftime lead, ultimately losing 34-31.

This time, there was no doubt who the better team was, nor which team can be certain it has a franchise quarterback on the rise.