SANTA CLARA — The 49ers’ 31-21 win over the Giants Sunday was a long time coming.

Sunday’s win was the Niners’ first of the season, the team’s first since Dec. 24 of 2016, and their first home win since Week 1 of last year. Like our San Francisco 49ers Facebook page for more 49ers news, commentary and conversation.

And if you want to go a level deeper, it was the team’s first win over a team not named the Rams since Dec. 6, 2015.

Yeah, it’s been a bit since we’ve seen the 49ers smile after a game.

And frankly, this team will likely go back to being a doormat for its final six games of the season — but that’s a conversation is for after the bye week.

Right now, Sunday’s win is fully worthy of celebration.

It was a testament to positive thinking and earnest effort — a clear-cut sign that 49ers’ head coach Kyle Shanahan has installed a winning culture in Santa Clara, even if Sunday’s game was his team’s victory win of the season.

That culture won Sunday’s game for the Niners, just as the Giants’ toxic culture lost them the contest.

The difference between the two bottom-barrel teams was stark. The NFL isn’t fair, but the worthy team won Sunday.

This 49ers team entered this season devoid of talent and a subsequent ravaging of injuries has only exacerbated that shortcoming. Truth be told, there was no reason to believe that the Niners would win a game this year — that’s how far behind the rest of the league (save for the Browns) San Francisco is when it comes to personnel.

But on Sunday, they met a worthy adversary — a team just as injury-ravaged and pitiful.

Yes, on paper, the Giants were the more talented team going into Sunday’s contest — but when talent is completely deactivated, as it was for New York on Sunday, the playing field levels out. It might have even tilted the game in the Niners’ favor.

Rarely will so ever see a team so openly disinterested in trying the way — the Giants’ effort Sunday might be the textbook case of phoning it in.

The Niners, on the other hand, were primed and engaged — playing every down with an energy that stated, loud and clear, that they were not interested in going 0-10.

But that effort level wasn’t new — that’s the way this Niners team, bless their hearts, has played week-in, week-out this season.

“Those guys have been working so hard, we just keep coming in every Monday so disappointed, by the time I see them every Wednesday, it’s like the first game of the year,” Shanahan said. “To have them still out there, still going like that, with how many we’ve lost in a row — that’s what gave us a chance to win today.”

The Niners, despite being winless and snakebitten going into Sunday’s game, didn’t follow the Giants’ path and quit — you have to give credit to Shanahan for that. Not only did he, in essence, hand-pick every player on this 49ers roster, but he’s also kept them motivated despite the adverse circumstances the team has faced this year.

This 49ers team could have easily quit. They had every reason to quit. But they didn’t, and Sunday’s win, as unimportant (and perhaps even detrimental) as it might be in the long run, was their reward.

“I’ve been a part of a lot of wins here. This win felt as good as winning the NFC Championship,” offensive lineman Joe Staley said.

Staley wasn’t being sarcastic, either.

“I know the record doesn’t show it, but this is honestly, one of the best teams I’ve ever been on, one of the best locker-room vibes I’ve ever been around,” tight end Garrett Celek, who had a 43-yard touchdown Sunday, said. “I wouldn’t want to be on any other team.”

Do you know how hard it is for a team to continue to put their bodies on the line every week when the stands are empty and the playoffs are an impossibility? When there’s a chunk of the fan base loudly calling for the team to go 0-16, so they could land the No. 1 pick.

An individual’s professional pride can only go so far — yes, Shanahan has the advantage of having a roster full of players who might not have jobs next week, much less next year; that creates some built-in motivation — but a strong, no-excuses culture, the kind Shanahan has fostered in his first year in Santa Clara, can persist.

“Most teams would give up, but that’s not the kind of guys we have in this locker room,” Celek said. “That’s because of the guys that Kyle and John pulled in here — that’s the type of culture we have here… In years past, I felt like we were missing something — I knew as soon as I met Kyle and John, I knew that they were going to change it.”

Will Sunday’s win result in more wins? Again, probably not this year — the talent level of this team is still far below par. Shanahan knows that, too.

“I got that monkey off my back, now I gotta to get my second one. That’ll eventually be a monkey too,” he joked.

But wins don’t create a winning culture.

That said, the culture that is being created in Santa Clara — the culture that brought the Niners their first win of the season Sunday — will bring plenty of wins in the years to come, so long as the Niners foster it and make offseason talent improvements.

This 49ers’ franchise has a long way to go before it’s truly competitive, but on Sunday, with its tenth-straight strong effort of the year — which just so happened to be a win — it showed that it is back to being respectable.