Peja Stojakovic scored 22 points and broke a tie with Dale Ellis for fourth place in career 3-pointers as the Dallas Mavericks beat the Houston Rockets 106-102 on Saturday night.

Stojakovic, who was 1 for 11 from 3-point range in his previous three games, went 4 for 6 from beyond the arc. He has 1,723 career 3s and trails only teammate Jason Kidd (1,756), Reggie Miller (2,560) and Ray Allen (2,562) in NBA history. Allen passed Miller for the lead Thursday.

Dirk Nowitzki also scored 22 points and Shawn Marion had 14 points and nine rebounds for the Mavericks, who have won 12 of their last 14 and eight of their past 11 games in Houston.

Kyle Lowry scored 26 points and Kevin Martin added 17 for the Rockets, who have dropped 17 of the last 23 meetings with Dallas.

The Mavericks built a 23-point lead in the second half, but then had to stave off a strong rally by the Rockets in the closing minutes.

Dallas shot 61 percent (25 of 41) in the first half and led 57-44 at the break. Houston went 1-for-8 from 3-point range in the opening half.

The Mavs stretched the lead over 20 early in the third quarter as the Rockets continued to misfire. Nowitzki and Stojakovic swished 3s to make it 72-49 and prompt cheers from large contingent of Dallas fans in the crowd.

Houston missed 16 of its first 20 shots after halftime and trailed 83-67 after three quarters. Stojakovic went 3 for 4 from 3-point range in the quarter, and the Mavs hit 10 of 17 shots overall.

The Rockets closed the gap in the fourth, as the Mavs started missing shots and giving away turnovers.

Aaron Brooks, who missed his first eight shots, and Shane Battier sank 3-pointers and the Rockets cut the Mavs' lead to 10. Dallas pushed the lead back into double digits, before the Rockets rallied again.

Battier swished a 3-pointer from the corner, and Brooks flipped a behind-the-back pass to Jordan Hill for a layup that made it 95-90 with 3 minutes left. Lowry scored inside with 2:18 remaining to cut the gap to three.

Nowitzki hit a wing jumper with 1:57 left and then Jason Terry chased down a loose ball and found Kidd for an easy layup to put Dallas up 99-92.

The Rockets missed their next three shots from 3-point range, and the Mavericks finished it off at the free-throw line.

Houston led 25-23 after one quarter. Nowitzki sank two mid-range jumpers at the start of an 8-0 spurt midway through the second quarter that put the Mavs up 39-32. Dallas hit seven of its first 10 shots in the second quarter, while the Rockets missed eight of their first 11.

Houston pulled within four, but the Mavs turned two missed shots by the Rockets into fast breaks that ended with powerful dunks by Marion and Tyson Chandler.

Stojakovic swished his first 3 in front of the Dallas bench with 44 seconds left in the half to break the tie with Ellis (1,719) for fourth all-time. The Mavs stood and cheered when the shot went down, apparently aware of its significance.

Notes: The Mavs have scored 100 points in 10 of their last 11 games. Dallas is 27-2 when it reaches 100 points this season. ... Dallas has hit a 3-pointer in an NBA-record 992 consecutive games. ... Martin was held under 20 points for the first time in six games. He went 0 for 4 from 3-point range, snapping a streak of 12 consecutive games with at least two 3-pointers.