NEW YORK (AP) — The shots were not falling for James Harden on Friday, except when he was at the free throw line.

He was nearly perfect there, going 19 for 20 as he scored 36 points to lead the Brooklyn Nets to a 115-113 victory over the Orlando Magic.

Harden added 10 rebounds and eight assists for the Nets, who played without Kevin Durant because of a right shoulder sprain. He was only 7 for 25 from the field, including 3 of 13 from 3-point range.

“I probably had to do a little bit more as far as being aggressive, and I had a lot of good looks as far as layups, floaters,” Harden said. “They just didn’t go in.”

Patty Mills added 22 points and LaMarcus Aldridge had 11 of his 15 in the fourth quarter.

Jalen Suggs scored 21, while Franz Wagner and Chuma Okeke each had 17 for the Magic.

“We’ve got to start coming out better in the second half of games, just play hard,” Okeke said. “I feel like that’s all it really is. Just play hard, play together. We could have come out with a win, but that’s something we can learn from and just build off of.”

The Nets trailed by 19 points in the second quarter, but ended the half on a 10-0 run. Harden scored the final five from the free throw line as Brooklyn reduced its halftime deficit to 62-53.

Mills’ back-to-back 3-pointers gave the Nets a 73-70 lead with 7:15 to go in the third quarter. It was their first lead since the opening bucket of the game.

“We were able to feed off some good energy,” Mills said. “In the second half we were able to get stops, get deflections and we ran down the other end like we were going downhill. We gained momentum and it became infectious throughout the whole group.”

Orlando trailed 90-83 heading into the final quarter, but tied the game at 92 on Okeke’s 3-pointer.

Neither team led by more than three until Harden’s two free throws with nine seconds remaining gave Brooklyn a 114-100 lead. After Suggs hit a layup, Harden went back to the line and made one along with his only miss of the game.

Cole Anthony, who finished with 16 points, was fouled with 3 seconds left. After making the first, he missed the second intentionally. However, his attempt did not hit the rim and the Nets were given possession and ran out the clock.

James Johnson finished with season highs of 17 points and 10 rebounds for the Nets.

“Whatever it takes for us to win. That’s what I’m here for,” Johnson said. “Five minutes, 10 minutes, whatever it takes.”

TIP-INS:

Magic: Orlando has started the same five players (Anthony, Mo Bamba, Wendell Carter Jr., Suggs, and Wagner) in every game this season except one. Gary Harris started in place of Suggs against the Hawks in Atlanta on November 15.

Nets: DeAndre’ Bembry made his first start of season replacing Durant. … Joe Harris missed his third straight game with a left ankle sprain. Paul Millsap was also out of the lineup due to “personal reasons.”

GAME-TIME DECISION

Durant participated in warm-ups, but was held out of the game. “It’s been bothering him a bit and it’s time for him to rest,” coach Steve Nash said before the game. “For tonight, it hurts the team. But, it’s a decision we had to make. He now can get a few days to rest.” The Nets don’t play again until Monday in Cleveland. Durant, who leads the Nets and is second in the NBA with 28.6 ppg, played in all of the Nets’ first 16 games.

NEW YORK STATE OF MIND

The Magic have played 31% of their games (5 of 16) this season against New York teams. They have already played the Knicks three times (2-1) and lost to the Nets twice.

LONG-DISTANCE TURNAROUND

In the team’s first meeting of the season, a 33-point Brooklyn victory on Nov. 10, Orlando shot 4 of 33 from 3-point range. In Friday’s game, the Magic shot 6 of 10 in the first quarter.

UP NEXT

Magic: Orlando travels to Milwaukee for consecutive games on Saturday and Monday.

Nets: Brooklyn visits Cleveland on Monday