Knicks center Karl-Anthony Towns reacts during the first half of...

Knicks center Karl-Anthony Towns reacts during the first half of an NBA game against the Washington Wizards on Saturday at Madison Square Garden. Credit: Noah K. Murray

The Knicks finally made themselves at home on Saturday night, and not a moment too soon.

Just when it looked as if they would start a long-awaited stretch of games at Madison Square Garden with a laugher against the hapless Wizards, things got complicated.

The Knicks won, 122-103, but saw a 33-point third-quarter lead dwindle to four early in the fourth quarter.

It would have been a shocking defeat, especially in the wake of back-to-back road losses to two other NBA also-rans in the Spurs and Hornets.

But the Knicks (44-26) figured out a way, using a 15-2 spurt to extend a 92-88 lead to 17 points in short order.

“For us to be the team that we want to be and the goals and aspirations we have, we have to be a team that plays for 48 minutes,” said Karl-Anthony Towns, who led the Knicks with 31 points and 11 rebounds.

“You can’t afford to have those moments when you have that kind of lull.”

The Knicks’ lead peaked at 79-46 with 8:14 left in the third quarter, at which point their defense got lax, their shooting went awry and the Wizards (15-55) got hot, led by Marcus Smart off the bench.

Smart’s three-pointer made it 92-88 with 9:14 remaining, part of a 42-13 run. Towns was shocked when reporters told him the margin had shrunk to four.

It was at that point that Cam Payne made a crucial three-pointer that calmed the Knicks and turned the tide.

Payne started in place of Deuce McBride, who missed the game with a groin injury. In only his second start of the season, Payne (13 points) scored 10 points in the first quarter and hit that big three in the fourth.

“He’s not afraid,” coach Tom Thibodeau said. “Cam is going to let it fly, which is what we like about him . . . That was a big shot.”

Like Towns, Payne said he had no idea the lead had dwindled to four.

“It felt good,” he said. “Especially after hitting the side of the backboard twice in a row, it felt good to see it go through . . . Glad I found a way to help us get the lead back up.”

The three-pointer started a 9-0 Knicks run.

Mikal Bridges scored 27 points — 20 of them in a second quarter in which he was 4-for-4 on three-pointers — and OG Anunoby scored 23. Tyler Kolek had seven of his eight assists in the second quarter.

Jordan Poole scored 25 points for Washington and Smart added 17.

The Knicks had played seven of their previous eight games away from the Garden. Entering the night, they were 3-6 in their past nine games and 3-4 since Jalen Brunson suffered a sprained right ankle against the Lakers on March 6.

Saturday’s game was the first of three in a row and five of six at home. They host the Mavericks on Tuesday and the Clippers on Wednesday.

The Wizards came into the game having played seven consecutive games on the road, then a home game against Orlando on Friday night.

Such is life in the NBA. But the Knicks’ losses to the Spurs and Hornets were alarming, so much so that Payne called it a “must-win for us to get back on the right track.”

Then it almost went off track.

“That’s the NBA for you,” Payne said. “We just have to make sure we play 48 minutes ... You can get beat any day.”

Said Towns, “We act like teams are just going to give us the win. This is the NBA, guys. They’ve got a lot of talent on that side. You could say it’s a learning experience, but we should know better.”

Notes & quotes: The Knicks issued a progress report on Brunson on Saturday, saying he is “doing controlled court work and his status will be updated in approximately one week.” . . . Thibodeau said he followed St. John’s season “from afar” and watched the Red Storm play when he could. St. John’s season ended on Saturday with an NCAA Tournament second-round loss to Arkansas. “They had a heck of a season,” Thibodeau said. “Rick [Pitino] has done an incredible job there.” ... It was HBCU night at the Garden, which honored the late Knicks captain Willis Reed, who attended Grambling State.