At the end of every quarter, Wesley Matthews looked up toward the Rose Garden rafters and thought: “Please, God, let me get through the next quarter.”

Before every timeout, he gazed up to the same bright arena lights and thought: “Let me get through this timeout.”

And after he hit a dagger three-pointer in the closing minute to cement the Trail Blazers’ 92-86 victory over the Boston Celtics Sunday night, Matthews couldn’t help but question his sanity.

“I was just hoping my leg stayed with me,” Matthews said, laughing. “As I was stepping back, I was like, ‘Oh, my god, what am I doing?’”

In another display of grit and guts, Matthews limped around the arena on one healthy leg and with one healthy arm for 38 minutes of inspirational basketball, willing the desperate Blazers to a much-needed victory before a sellout crowd of 20,484. Matthews finished with a game-high 24 points, helping the Blazers end their season-long seven-game losing streak and providing a lifeline to their dying playoff hopes.

“That’s typical Wes,” said Blazers point guard Damian Lillard, who had 12 points and six assists. “In a way, he’s the heart of our team. He plays with a lot of emotion. He plays harder than everybody, in my opinion, and he does it every possession.”

And the Blazers needed every fiber of that emotion and all-out effort Sunday night against the Celtics as they fought to the final horn to end their losing streak. After trailing by as many as 11 points, the veteran Celtics closed with a flurry in the final minutes, using an 8-2 run to even the game at 86-86 after Kevin Garnett completed a driving layup with 1:46 left.

After suffering mystifying losses to the Phoenix Suns, New Orleans Hornets and Orlando Magic and nail-biting defeats to the Los Angeles Lakers and Miami Heat in recent weeks, it seemed all but certain the Blazers would fade in similar fashion against the Celtics. Instead, 14 seconds after Garnet’s layup, Lillard converted a clutch three-point play, making a tough driving layup and a free throw.

Then, after Paul Pierce bricked a three-pointer, Matthews delivered the shot of the night. On the next possession, the Blazers ran most of the time off the shot clock and found Matthews at the top of the key. Just before the clock expired, he hedged toward the hoop and stepped back, launching a three that swished with 53.9 seconds left.