DALLAS -- Dirk Nowitzki is an All-Star again, and the big German is playing like he did when he went to 11 straight midseason showcases.
The 35-year-old had his second straight 30-point game for the first time in nearly two years and helped the Mavericks rally in the fourth quarter after they squandered a double-digit lead in the first half and fell behind by 14 in the third.
"I've been in a good groove," said Nowitzki, who was named an All-Star reserve Thursday after his long streak of appearances ended last season when he missed the first 27 games after knee surgery. "Before the last three, I didn't really have a good groove."
Rudy Gay scored 35 to lead the Kings, who have the worst record in the Western Conference at 15-31 and were without Cousins for the fifth straight game because of a sprained left ankle. He is likely to miss his sixth straight in San Antonio on Saturday night.
"We have to learn how to be a winning team," said Gay, who had 18 at halftime by making all six shots from the field and 6 of 7 free throws. "We just have to play a whole solid game. That's what we need to do for us to get off that slide we're on right now."
Nowitzki backed up his 12th All-Star nod while Cousins had to sit out a chance to show he belonged in the Feb. 16 game. The fourth-year center is in the top 10 in the league in scoring and rebounding.
"There's always guys that deserve it," said Nowitzki, who's in his 16th season. "Maybe this is my last hurrah."
Brandan Wright had his first double-double of the season with 10 points and 10 rebounds, including a floater in the lane that put the Mavericks ahead for good at 96-94.
Sacramento was still within two after a 3-pointer by Marcus Thornton, but Ellis made a pair of free throws to make it a two-possession game with 4.6 seconds left.
Ellis was in his worst three-game scoring slump of the season and didn't have a point most of the first half before getting 11 in the fourth quarter and finishing with 20.
"It was one of those nights where he could have easily gotten frustrated, but he didn't," Dallas coach Rick Carlisle said. "He just kept playing the whole game and it came around."
The Mavericks, who couldn't hold a double-digit lead in the first half, went back in front with a 9-0 run capped by a pair of free throws from Nowitzki for an 89-87 lead midway through the fourth quarter.
The Kings matched their longest skid of the season despite starting the second half with a 17-3 run that included consecutive 3-pointers from Isaiah Thomas, who scored 13 in the third quarter but was held to two points on 1-of-7 shooting in the fourth.
Thomas finished with 19, but he and Gay were the only double-figure scorers for the Kings.
"I'm frustrated with myself because my shot's not falling," Thomas said. "DeMarcus makes things a lot easier for me. Hopefully he gets back soon."
Sacramento's lead grew to 14 on a layup by Aaron Gray before the Mavericks finished the third on an 11-3 run highlighted by Ellis' steal and breakaway dunk that got the deficit back under 10 at 78-70.
The Mavericks played without Shawn Marion, who has lingering soreness from shoulder and ribs injuries sustained in early January. He missed the first four games after getting injured.
Dallas' Jose Calderon and Thomas were called for a double technical when Calderon went to the floor away from the ball after making contact with Thomas. Calderon got up yelling at Thomas and kept going after a whistle stopped play, leading to the technical. The pair had a friendly halftime chat mediated by referee Tony Brothers. ... Nowitzki had his third career game of at least 38 points and 17 rebounds in Wednesday's loss to Houston. The Mavericks won the other two. ... The Mavericks recalled G Ricky Ledo from the NBA Development League before the game and sent him back down afterward.