James scored 25 points, moving into 10th place on the NBA's career list, and added 14 assists and eight rebounds as the unbeaten Cavaliers held off the winless 76ers 102-101 on Saturday night.
"It's always great to have these kinds of games," James said. "We will clean it up. It's a great learning experience for us. I know we have room for improvement."
Kevin Love added 20 points and 11 rebounds for the reigning champion Cavaliers, who improved to 6-0.
Coach Tyronn Lue wasn't disappointed, either, that the result was so surprisingly close.
"We stayed poised," Lue said. "We were tested tonight. Overall, I'm pleased to come out with a win when we had some adversity."
Joel Embiid scored 22 points, making all four of his 3-point attempts, but the 76ers dropped to 0-5.
James passed Hall of Famer Hakeem Olajuwon by converting a fast-break layup midway through the first quarter. Olajuwon finished his career with 26,946 points.
It looked to be an easy night for the Cavaliers at that point. But the 76ers nearly shocked them.
Channing Frye's 3-pointer with 1:05 left gave the Cavaliers a 102-101 lead.
After a turnover by Philadelphia's Sergio Rodriguez, J.R. Smith missed a 3 with 15 seconds left that would've clinched it. Philadelphia coach Brett Brown then called a timeout with 7.3 seconds remaining. The 76ers were trying to get the ball to Embiid, but they couldn't and Gerald Henderson turned the ball over as he tried to get a shot off in the final seconds.
Henderson said a foul should've been called on the play.
"We tried to run something to get it in to (Embiid)," he said. "Time was running down so I just took it myself. I got fouled. They didn't call it. And it's the end of the game."
Said Brown, "The tape will show what the tape shows. That's obviously a tough way to end a great game."
James' first attempt at passing the record was an emphatic, highlight-reel block by Embiid about 3 1/2 minutes into the contest. After two more misses, James quickly raced up the court for an easy layup to reach the milestone.
"It's a blessing and an honor," James said.
He is No. 12 in scoring on the combined ABA/NBA list.
The 76ers remained one of three winless teams in the NBA, along with Dallas and New Orleans. Philadelphia opened last season by tying a league record with 18 straight losses.
Philadelphia battled back from an 18-point, first-half deficit.
Philadelphia outscored Cleveland 16-9 over the first 5:50 of the final quarter, taking its biggest lead on Henderson's short jumper that made it 96-91 with 6:10 remaining. Smith's 3-pointer with 2:50 left put Cleveland back in front, 99-98. But Ersan Ilyasova answered with a 3-pointer 13 seconds later to give the 76ers a 101-99 advantage.
The Cavaliers used a 16-0 run to finish the first quarter, helping them to a 34-19 lead. James played all 12 minutes of the opening quarter, finishing with six points, four rebounds and seven assists.
The Cavaliers led 57-46 at halftime.
NOT THEIR MONTHS
The 76ers have lost their last 42 games in October and November, dating to an overtime win over Milwaukee on Nov. 22, 2013.
Ilyasova, playing in his second game for Philadelphia after being acquired on Tuesday from Oklahoma City for Jerami Grant, added 21 points.
Kyrie Irving, who entered ninth in the NBA in scoring (26.0 ppg), scored eight points on 3-for-17 shooting.
Cavaliers: Cleveland is off to its best start since the 1976-77 Cavaliers opened 8-0. It also is the best start for a James team. ... Love went down hard with 6:47 left in the second quarter after a block attempt by Embiid. No foul was called on the play.
76ers: Former Phillies slugger Ryan Howard was among the sell-out crowd. Two seats to his left were hip hop star Nicki Minaj and rapper Meek Mill. ... Philadelphia entered last in the league in scoring (90.8 ppg), while the Cavaliers were first (114.4).
Cavaliers: Host Atlanta on Tuesday night.
76ers: Host Utah on Monday night.
No regrets as Maker eyes playoff clash against Bucks
A lot has happened to Thon Maker this season. He opens up to ESPN.com.au about his time at Milwaukee, trade to Detroit and a possible playoffs clash against his old team.
Durant comes on late for All-Star Game MVP
Kevin Durant shoots an efficient 10-of-15 from the field to claim MVP honors at the NBA All-Star Game.
Greek Freak scores 38, has his own personal dunk contest at ASG
Giannis Antetokounmpo throws down several nasty dunks, leads his team in points with 38 in a loss to Team LeBron.