Knicks center Karl-Anthony Towns celebrates late in the fourth quarter of...

Knicks center Karl-Anthony Towns celebrates late in the fourth quarter of a win over the Detroit Pistons in Game 4 of an NBA first-round playoff series Sunday in Detroit. Credit: AP/Duane Burleson

The Detroit Pistons sent everything they had at Karl-Anthony Towns.

Tobias Harris, who knows Towns well from growing up in the New York area, bumped, pushed and yelled at the Knicks center so forcefully that the two nearly had to be separated in the second quarter. Then, with the Knicks furiously trying to come back early in the fourth quarter, Ausar Thompson leaped on Towns’ back as if they were two guys in a cage match while a stone-faced official looked on.

But when it mattered most, Towns blocked it all out and knocked down the most important shot of his Knicks career to give his team a 94-93 victory in Game 4 and put the Pistons on the brink of elimination in the first-round series.

Towns faked, started to drive but then pulled up and shot a 27-foot three-pointer for the go-ahead basket with 47 seconds left in a crazy game in which the Knicks came back from an 11-point fourth-quarter deficit.

Towns scored 27 points, including eight in the final 2:43. Those included an earlier three-pointer and a difficult baseline jumper that cut the Pistons’ lead to 93-91.

“He has tremendous confidence,” coach Tom Thibodeau said. “He has an amazing touch. He shoots the ball like a guard. He has unlimited range and he can score off the dribble. He can score back to the basket. He can score a lot of different ways. When he’s moving around, that’s when he’s the hardest to guard. We have to continue to search him out and he has to continue to move.”

It was the second straight big game for Towns, who made a playoff career-high five three-pointers (in seven attempts) and is playing with the kind of offensive force that the Knicks envisioned when they traded for him before training camp.

Indeed, Towns seemed to take his game to the next level in Detroit. Heading into Game 3, he was taking a lot of heat after going scoreless in the fourth quarter of the Knicks’ Game 2 loss. Harris went so far as to imply that this season’s Knicks team is soft compared with the team he lost to in the first round last year when he was with the 76ers.

But there has been nothing soft about Towns the last two games.

When he plays well and is a versatile scoring threat, defenses have to commit an extra defender on him, leaving others open to score. When Towns got off to a fast start on Sunday, the Knicks were able to build a 16-point lead. When he struggled later, the Pistons were able to battle back.

With the officials not making a lot of calls, the Pistons played as physically as they could against Towns. After the game, he said he didn’t expect anything less.

“I mean it’s competition. It’s the NBA playoffs,” he said. “You expect nothing but the greatest competition right now in NBA basketball this season. You go out there, you wanna match their physicality. You understand you’re in Detroit. You’re playing Detroit, who hasn’t been in the playoffs, and they have a lot of pride right now.”

Towns expects to see more of the same in Tuesday’s Game 5 at Madison Square Garden with the Pistons needing to win to bring the series back home.

“They haven’t seen the playoffs in a while, so they want to fight for their city. And as much as they want to fight for their city, we’re trying to fight for our city,’’ he said. “I think this is a great series for the NBA. I think it gives a little bit of old-school vibes. I think this is great for kids watching who haven’t been able to see old-school basketball to see this kind of reminiscent game of old-school physicality.”

The kind of physicality that Knicks fans have been waiting to see all season.