The needle of hope might just be flicking a little bit for these Mavericks. If they can beat the Denver Nuggets, who have had their number all season, perhaps anything’s possible.

For the first time this season, the Mavericks took down Denver — a team that is headed to the lottery but was 3-0 against Rick Carlisle’s bunch before Friday.

A balanced attack that yielded a big-time offensive night cleared the decks for a 122-106 victory at American Airlines Center as Monta Ellis scored in rapid-fire fashion in the fourth quarter and finished with 26 points.

Ellis made all six of his shots in the period and scored 14 points, including 10 in a 3:24 stretch late when Dallas’ lead swelled from six to 16 points.

If you didn’t know better, you’d think Ellis was making a bid to be the Mavericks’ designated closer, a role normally reserved for Dirk Nowitzki.

“He’s got the confidence to do it,” Nowitzki said. “Confidence in this league is like 80 percent [of success]. There’s obviously some skill involved. But if you have that confidence, then you’ve arrived. And he’s been great all season for us when we do give him the ball attacking. And he’s been shooting the 3-ball well lately. That makes him tough to guard.”

Ellis said he was taking what the defense allowed in the fourth quarter. The Nuggets got as close as 99-96 before Ellis led the Mavericks on a 23-10 blitz down the stretch.

The win means only one team in the Western Conference — San Antonio — has a chance to sweep the season series from the Mavericks, who meet the Spurs for the final time in the regular season on April 10.

After dropping the first three games against the Nuggets, the Mavericks clearly were focused on not losing a fourth.

Dallas also moved to 42-28 and kept pace in its chase for playoff positioning with Memphis, Golden State and Phoenix.

“We want to stay on that pace where we can head in the direction where we can get 50 wins and try to get a great seed in the West [playoffs],” Ellis said.

It was an interesting night during which the Mavericks showed that when they are executing and confronted with a soft defensive team, they can outscore just about anybody, including the Nuggets, who aren’t shy about running and gunning.

“Monta Ellis closed the game for us,” Carlisle said. “He was fantastic. He made drives, he made outside shots, he made assists.

“He’s always going to be in an attacking mode. The thing we’ve got to do is get him in the best possible situations. He really answered the bell down the stretch. He was struggling in the third quarter. I was going to sub him out, and he made a layup, and I pulled Devin [Harris] back.”

Ellis didn’t miss another shot.

He did have some help. Nowitzki knocked down 21 points, and three bench players — Vince Carter (13), Jae Crowder (12) and Brandan Wright (13) all scored in double figures. Crowder hit all four of his 3-point attempts in the second quarter, when the Mavericks took charge, opening a 15-point advantage.

The only downer came in the first quarter when Carter dislocated the pinky finger on his right hand. He returned to the locker room, then came back and played. The finger popped out of joint again, and he went back to the locker room and had X-rays, which were negative, then returned to the game.

Carter had the finger taped up, but it did not keep him from getting on the floor and making hustle plays, nor did it impact his shooting. He made 3-of-5 from 3-point range.