BOSTON — Despite one of the worst shooting nights of Kevin Garnett’s career, the Boston Celtics found a way to get a big fourth-quarter rally against the Washington Wizards.

Ray Allen scored 25 points, including a go-ahead 3-pointer with 17.1 seconds remaining, and the Celtics surged past the Washington Wizards 86-83 on Sunday.

“Fans, people around the building look at other teams and tend to think they are not supposed to score or even be in the game,” Allen said. “(The Wizards) are getting paid the same as we are and I told the guys at halftime that we need to make them more uncomfortable.”

Boston trailed 79-66 with 6:11 remaining but closed out the game with a 20-4 run, getting eight points from Allen and six from Rajon Rondo.

“Well, we choked. Six minutes to go and we’re up 13 and we start talking to Garnett, start talking trash and everything else,” Wizards Coach Flip Saunders said. “Got Garnett and those guys juiced up.”

The Celtics cut the deficit to 79-76 before Washington’s JaVale McGee dunked after a Randy Foye miss with 2:38 left, but the Celtics scored the next six points, capped by Allen’s 3-pointer for an 82-81 Boston lead with 1:33 remaining.

On the next possession, Foye hit a jumper in the lane to put the Wizards ahead 83-82.

Foye missed a 3-pointer with 35 seconds remaining, and a scramble for the rebound ensued before Kevin Garnett grabbed the ball and called a timeout. Allen then made it 85-83 with his 3-pointer from the corner, and Garnett added a free throw before Al Thornton’s 3-pointer went off the rim at the buzzer.

“We’ve lost so many of these where we played poorly and lost,” Celtics Coach Doc Rivers said. “It was nice to play poorly and win. I just wish we could have played the first 40 minutes like we played the last eight.”

Thornton scored 24 points and grabbed 11 rebounds, while Andray Blatche added 23 points and nine rebounds for Washington.

“We were so discombobulated,” Saunders said. “You have a veteran team that knows how to close out games against a young team, and instead of letting a sleeping dog lie, we juiced up their energies.”

Garnett was 0 for 7 from the floor and finished with eight points. It was the first time he was held without a field goal since Jan. 27, 1996, against New York when he was playing for Minnesota.

Paul Pierce scored 17 points.

“Once our defensive intensity picked up, it changed the whole ballgame, making them do things they didn’t want to do,” Pierce said.