New York Knicks guard Derrick Rose (25) drives to the...

New York Knicks guard Derrick Rose (25) drives to the basket against Boston Celtics center Al Horford, right, during the second half of an NBA basketball game in Boston, Wednesday, Jan. 18, 2017. Rose scored 30 as the Knicks defeated the Celtics 117-106. (AP Photo/Charles Krupa) Credit: AP/Charles Krupa

BOSTON — With all the drama and the losing that has engulfed the Knicks, Jeff Hornacek asked the players whether they believed they could get back in the playoffs.

Hornacek said their answer was a resounding yes and then the Knicks followed that with one of their best games of the season, and a rare complete one.

The undermanned Knicks played all out, got a 30-point game from Derrick Rose and a big lift from the bench and knocked off the Boston Celtics, 117-106, Wednesday night at TD Garden in a victory that they want to believe will spark them going forward.

“We hope this is it,” Hornacek said. “Before the game, I asked them: ‘Do you guys believe we still got a chance to get back in the playoffs.’ They said absolutely. It’s good to hear that and then have those guys come out and play like that.”

Boston (26-16) is one of the best teams in the East, and the Knicks led the last 30:18 of the game.

Rose shot 13-for-24 overall and scored 12 in the fourth quarter when the Knicks (19-24) pulled away from the Celtics.

Without Kristaps Porzingis (sore left Achilles), Joakim Noah (sprained left ankle) and Lance Thomas (fractured left orbital bone), the Knicks led by 14 in the fourth and won for just the third time in the last 14 games. The Knicks, who are now 5-0 when Noah doesn’t play, are in 11th place, two games out of eighth.

The bench ignited the Knicks, scoring 55 points and helping turn a nine-point deficit in the first quarter into a nine-point lead in the second. The Knicks held a 57-33 rebounding edge against Boston (as they played with the effort that has been missing on many nights.

“They punked us,” Celtics guard Isaiah Thomas said after scoring a game-high 39. “They were the harder playing team on both ends of the floor.”

Willy Hernangomez had 17 points and 11 rebounds to lead the bench effort. Mindaugas Kuzminskas, who started his second straight game, also had 17. Carmelo Anthony finished with 13.

Reserve guard Justin Holiday also had 13 points and Courtney Lee had a solid all-around game with nine points, eight rebounds and seven assists off the bench.

“It was a big win for us to come in here, kind of put everything to the side despite what’s been surrounding the team and really focus in on playing basketball and winning,” said Anthony, who’s Tuesday meeting about his future with Knicks president Phil Jackson dominated the headlines.

“These guys are a determined bunch,” Hornacek said. “We’ve had some bad breaks. We’ve had some bad games. But they stay in there together.”

Jae Crowder added 21 for the Celtics, who were without starting guard Avery Bradley (right Achilles). Center Al Horford had a rough night, as he shot just 2-for-14 from the field, including 1-for-8 from three-point range.

The Knicks led 88-83 to start the fourth, but the Celtics cut it to 97-96 with 7:57 left. The Knicks answered with back-to-back threes by Holiday and Lee to make it 103-96 and never looked back.

Later, the Knicks went ahead at 112-100 after an Anthony three-pointer, and a Rose pull-up jumper with 4:09 remaining. It stayed that way until another Rose pull-up with 2:25 left made it 114-100. The Knicks never let it get under 10 after that.

“We lost a lot of games this year so it is good to win one,” Rose said. “Hopefully a win like this can spark something.”