Julius Randle scored a game-high 28 points and recorded his first triple-double of the season Tuesday night, when the New York Knicks frittered away a 16-point, second-quarter lead before gradually pulling away from the host Cleveland Cavaliers for a 95-86 win.

With their second straight win, the Knicks got to .500 at 2-2 — the deepest into a season they have been at .500 since they were 18-18 on Dec. 30, 2017.

The Cavaliers were trying to start 4-0 for the first time since 2016-17.

Randle finished with 12 rebounds and tied a career-high with 11 assists as he became the first Knicks player to score 20 points in a triple-double since Carmelo Anthony on April 17, 2012.

Elfrid Payton finished with 14 points, eight rebounds and seven assists. Reggie Bullock had 17 points, RJ Barrett scored 12 points and Mitchell Robinson had nine points and 10 rebounds.

Andre Drummond had a double-double for the Cavaliers with 18 points and 17 rebounds. Collin Sexton led Cleveland with 20 points, followed by Darius Garland with 17, JaVale McGee with 11 points and Larry Nance Jr. with nine.

The Knicks opened their first double-digit lead by going on a 10-0 run to go ahead 20-10 with 3:43 left. The Cavaliers missed all seven of their field goal attempts during the run.

The Knicks led 29-15 at the end of the first and went ahead 32-16 on Kevin Knox II’s 3-pointer 46 seconds into the second. The Cavaliers responded with a 24-8 run to tie the game at 40-40. Sexton scored seven points during the surge, and Cleveland tied the game on back-to-back baskets by McGee.

The Cavaliers had a chance to take the lead after Payton missed a 3-pointer, but Cedi Osman and Garland missed 3-pointers on the subsequent possession, and New York finished the half on a 13-6 run punctuated by 3-pointers by Randle and Bullock in the final 17 seconds.

The Cavaliers got within one point on a 3-pointer by Garland with 9:26 left in the third and closed the Knicks’ lead to 60-58 on another 3-pointer by Garland with 7:16 to go.

But New York led 71-64 at the end of the third and never led by fewer than seven in the fourth quarter.