You’ll have to excuse Jeremy Lin for feeling a little disoriented when he stepped on the Barclays Center court Sunday night. It had been three months since he had last played there, and it took him three quarters to remember how to do it.

No harm, though. By the final buzzer, he had made himself right at home.

The point guard, who came back in time for the team’s eight-game road trip, scored nine of his 13 points in the fourth quarter and combined with Caris Le Vert to stop Carmelo Anthony on a drive in the Nets’ 120-112 win over the Knicks.

“I think I was still out West for the first 3 1⁄2 quarters and gladly, I was able to show up a little bit,” he said. “It felt like I was letting my team down and, I don’t know, I wasn’t doing what I felt like I needed to do. I just tried to stay aggressive and really kept my mind on playing my position. I think that was able to calm me down a little bit, and keep attacking, because I feel part of me was, ‘Man, you should not attack.’ ”

In the final five minutes, Lin played like a man who had grown tired of his perpetual place on the bench — the product of the hamstring injury that has derailed his first season with the Nets. He hit a three-pointer with about five minutes left for his first field goal and drew Kristaps Porzingis’ sixth foul.

“It was massive,” Brook Lopez said of Lin’s three-pointer. “I can’t really say how big it was. We have unlimited confidence in him and we completely believe in him and he’s paramount to what we do, both offensively and defensively. We had that trust and faith in him.”

Not only were the Nets able to get the win in front of a couple of thousand Knicks fans who view Barc lays as their home away from the Garden, but they did it by playing the type of basketball Kenny Atkinson has been championing since the beginning. They shared the ball, Lopez was a threat inside and out (25 points, 6-for-9 on three-pointers) and Lin again reminded the Nets why they brought him here. He is a facilitator, a veteran presence among a team of unproven players, and he can take control when need be.

Subscribe to Sports Now newsletter By clicking Sign up, you agree to our privacy policy.

“To have that kind of moxie to take that shot, that was big,” Atkinson said of the three that put the Nets up 109-101. “To get a guy that’s been in the league and has done it before, it’s huge for us.”

Atkinson thought he saw some fatigue, but Lin said he thinks he’s finally back. “I just wanted to recover from the road, and I think once I settle from that, it should be smooth sailing,” he said. “It did feel a little bit like a road game, to be honest. Part of it was just the divide in the fans, but also just not playing in here . . . It felt really weird walking in. Everything felt weird.”

Until everything went right.