A frustrating night for Carmelo Anthony (7) and the Knicks, who can’t put away Kevin Garnett and the Celtics. Game 6 of the first-round playoff series is Friday night in Boston. (Kathy Willens/AP)

Most members of the New York Knicks arrived at Madison Square Garden dressed in funeral black, prepared to bury a seemingly battered, weakened and creaky team. Their fans arrived prepared for a celebration. They all left the arena with looks of dejection and bewilderment.

Closing out the Boston Celtics wasn’t supposed to be this difficult for the Knicks, especially after they won the first three games by exploiting their superior depth, talent and athleticism. But the Knicks have continually taunted and tested the Celtics — either with an unnecessary elbow or some overconfident boasts — and now find themselves in a struggle.

If this is, indeed, the final stand for Kevin Garnett, Paul Pierce and the Celtics, they have no intention of going down meekly. And with a stunning 92-86 victory on Wednesday, the Celtics moved within 3-2 in their best-of-seven series and again showed how dangerous it is to write them off for dead.

“We was going to a funeral, man,” Knicks backup guard J.R. Smith said, “but it looks like we got buried.”

The Knicks scored the first 11 points, but faded as Boston stifled Carmelo Anthony for the second game in a row and Smith, back after serving a one-game suspension for elbowing Jason Terry, shot his team out of the contest. Jeff Green scored a team-high 18 points and hit two three-pointers to give the Celtics a 12-point lead with 2 minutes 24 seconds left. Then, Garnett put the game out of reach in the final minute, when he pump-faked, dribbled, pumped again, and knocked down a long jumper as Knicks center Tyson Chandler flew past him.

Game 6 will be on Friday at TD Garden in Boston.

“It was a Game 7 mentality,” Garnett said. “It’s an all-out mentality. There’s no tomorrow. We’re still down 3-2, so our mentality has to be all out — nothing more than that. The next game we lose is it.”

Rumors have swirled that the 37-year-old Garnett might retire at the end of the season, and if that is the case, he is going down with all that he has. Garnett finished with 16 points and grabbed 18 rebounds, the third consecutive game that he had at least 17 boards.

“He was fantastic,” Celtics Coach Doc Rivers said of Garnett. “His rebounding and his presence defensively has been unbelievable for us.”

Garnett got tangled near the free throw line with Anthony early in the fourth quarter and appeared to yank Anthony’s left arm as Anthony tried to break free. Anthony fell over, grimacing in pain as his shoulder fell limp, but it only seemed to encapsulate another rough outing for the all-star forward.

Anthony scored 12 points and shot 5 of 7 in the first period, attacking the basket and diving through seams in the Celtics’ defense for easy scores inside. But he missed 14 of his final 17 shots, finishing with 22 points.

“We good,” Anthony said. “We had two chances to close it out. Them guys came in here and took a game from us. Mentally, we in a good place. We’ll see what we made of in the Garden in Boston.”

Smith said the series would’ve been over had he played in Game 4 and even acted as if he had never heard of Terry when asked about him the day before. But he backed up his words with a horrific performance that proved to be detrimental in almost every way. He missed his first 10 shots and picked up a technical foul after another exchange with Terry, who made five three-pointers and scored 17 points off the bench.

Boston hasn’t allowed the Knicks to convert more than nine three-pointers in any game this series. New York only had two three-pointers through the first 45 minutes of Game 5 and was in a tough spot when reserve Steve Novak, one of the best shooters on the team, was forced to leave with back spasms after playing just three minutes. Smith (11 points) made all of his three-pointers in the final three minutes.

“Nobody said it was going to be easy to win this series,” Knicks Coach Mike Woodson said. “At the end of the day, we still control our destiny and there is a lot of basketball to be played.”

Rivers tightened his rotation to just seven players, relying on the veterans that he trusted. Pierce missed his first six field goal attempts, but finished with 16 points. Brandon Bass scored 17 points and again teamed with Green to harass Anthony. Former Wizard Jordan Crawford didn’t play, but managed to get into the middle of a tussle after the game as he exchanged words with Anthony.

Knicks point guard Raymond Felton, who scored 21 points, took exception and started shoving Celtics forward D.J. White, who attempted to separate the players.

“I didn’t see it,” Rivers said. “I wasn’t happy with it. [Woodson] wasn’t happy with it. Let’s play basketball. Let’s play really physical basketball and let’s walk off the floor.”