BOSTON – Paul Pierce outscored Ray Allen 28-6 in the first 47 minutes, 49 seconds against Portland on Wednesday night.

When Pierce had the ball in the final minute, though, he knew who should take the last shot.

“It’s just trust. We talk about it all the time,” Celtics Coach Doc Rivers said, “and it works sometimes.”

Allen missed his first five 3-point attempts before hitting one with 10.7 seconds left, and Boston held on to beat the Trail Blazers 99-95 despite blowing almost all of a 16-point, fourth-quarter lead.

“I was looking at the rim and the ball wouldn’t fall for me. I was ready to take each next shot,” Allen said.

“There were a lot of last shots that would have been the last shot if they went down for us. It was an unfortunate predicament.”

It was Boston’s fifth straight victory and the fifth straight loss for Portland.

Kevin Garnett had 17 points and eight rebounds despite missing most of the third quarter with a cut on his chin that needed five stitches. Rajon Rondo had 10 points and 10 assists as the Celtics built a 96-80 lead, then watched the Blazers score 15 in a row to make it a one-point game with 42 seconds left.

Pierce dribbled down the 24-second clock, then passed to Allen on the left side for the clinching 3-pointer.

“He’s one of the greatest shooters of all times,” Pierce said. “When you need him most, he’s going to be there.”

Wesley Matthews scored 23 points, including 5-of-7 shooting from 3-point range, and Andre Miller had 20 for the Blazers. LaMarcus Aldridge and Brandon Roy each had 18 points, and former University of Massachusetts star Marcus Camby had nine rebounds and four blocked shots.

Pierce went 9 for 11 from the floor, making his first four 3-point attempts to help the Celtics shoot 57 percent as a team in the game. Shaquille O’Neal scored 14 points, and reserve Glen Davis added 16 points and seven rebounds.

All of them made more than half their shots.

But not Allen, who was just 3 for 12 from the floor for nine points.

“He’s a great shooter and you’ve got to know where he’s at,” Blazers Coach Nate McMillan said. “Whether he’s missed five in a row, he’s going to take it. He’s a big-time shooter.”

The Blazers led by as many as 11 points in the first half and had a 68-62 lead in the third before Boston scored 17 of the last 21 points in the quarter. The Celtics made it a 16-point game before the shots stopped falling.

Rudy Fernandez hit a 3-pointer, Matthews added a layup, then Pierce missed everything on a 3-pointer before Roy scored on a fadeaway jumper to cut Boston’s lead to 96-95. After a timeout, Allen regained his touch, then Miller and Aldridge each missed 3-pointers in the closing seconds as Portland tried to get back in it.

The Blazers have struggled in the fourth quarter in the past week, scoring just 42 points total in the final period in their last three games. They had 20 in the game before that, but they gave up 38 as the Utah Jazz rallied from a nine-point deficit to win, 103-94.

This time, the fourth quarter was their strongest.

The Blazers led by 11 in the second before Boston scored 14 of the next 16 points, including a pair of 3-pointers by Pierce, and took the lead on a put-back dunk by O’Neal that made it 44-43 with 90 seconds left in the half. But Matthews hit a 3-pointer just 0.3 seconds before the buzzer to give the Blazers a 49-48 lead at the break.

Rondo pump faked to the left and then passed right to Pierce for a 3-pointer that made it 77-72 with 32 seconds left in the third. The Celtics then made it a seven-point game when Garnett, who nearly turned the ball over on a bad dribble, gathered it up and hit a long 2-pointer with 0.7 left.