HOUSTON (AP) James Harden wasn't at his best on Tuesday night.
The Houston Rockets still got a win over the Orlando Magic thanks to contributions from across the lineup.
Donatas Motiejunas scored 23 points and the Rockets used a big run late in the fourth quarter to break open a close game and get the 107-94 victory.
Harden, who is second in the NBA in scoring, went 4 for 14, but made eight free throws to finish with 17 points on a night when six Rockets finished in double figures.
''That's the beauty of this team,'' Harden said. ''You got five or six guys in double figures. That means the ball is moving around and that means guys are getting good shots. No matter if I struggle or not, we still win and that's a great thing.''
A driving layup by Victor Oladipo got the Magic within two points with about five minutes left before the Rockets used a 13-0 run, powered by three 3-pointers, to make it 107-92 with less than a minute remaining.
Orlando's only points in the last 4:40 came on a basket by Ben Gordon with about 40 seconds left.
Oladipo's 29 points led the Magic, who have dropped four in a row.
''Teams play the best in the fourth quarter, the level is raised, and Houston raised (its) level and we responded with the right effort, but we didn't execute enough,'' Magic coach James Borrego said.
Along with Motiejunas and Harden, Trevor Ariza (17), Josh Smith (17), Corey Brewer (13) and Patrick Beverley (12) also scored more than 10 points.
Orlando was up by 3 early in the fourth quarter when Houston went on a 9-2 run, capped by a one-handed slam by Smith, to take an 86-82 lead with about nine minutes remaining.
Houston led by a basket with about eight minutes left in the third quarter when Oladipo swiped the ball from Harden and finished on the other end with a two-handed dunk to tie it up.
The teams exchanged the lead several times in the third quarter after that but neither team led by more than three points until the Magic made seven straight points, with by a 3-pointer by Channing Frye, to take a 78-71 lead.
But Smith made two 3-pointers in the last 27 seconds of the third quarter, including one at the buzzer with Frye in his face, to cut the lead to 78-77 entering the fourth quarter.
''We had no momentum at that time,'' coach Kevin McHale said. ''We couldn't stop them and they were feeling good about themselves. Josh's two 3's at the end of the third were huge.''
The Rockets were up by one midway through the second quarter when they went on an 8-4 run, with all of their points by Motiejunas, to push the lead to 46-41 about three minutes before halftime.
But Gordon made five quick points to start a 7-0 run by the Magic that gave them a 48-46 lead.
The game was tied soon after that when Gordon was called for goaltending on a shot by Harden that he was fouled on. Harden was 0 for 6 before that shot and made the free throw to put Houston back on top.
The Rockets led 51-50 at halftime.
Magic: The Magic won the first meeting this season 120-113. ... F Tobias Harris sprained his left ankle in the second quarter and didn't return.
Rockets: McHale switched up the lineup on Tuesday night, starting Joey Dorsey in place of Terrence Jones, who had started the last 11 games. McHale wouldn't say why he made the change telling reporters to ask Jones about it. Jones would only say that he didn't start because of a ''personal issue.'' ... Brewer had a season-high 12 rebounds.
Houston C Dwight Howard, who hasn't played since Jan. 23 because of swelling in his right knee, is improving and has been practicing in a limited basis this week. McHale said Howard is getting a lot better, but still isn't sure when he'll play again.
The Rockets signed 16-year-old Bryson Jones to a one-day contract on Tuesday as a request from the Make-A-Wish foundation. Jones, who has a degenerative muscle disorder, always dreamed of playing for the Rockets. He was surrounded by the team on Tuesday morning after shootaround when he smiled broadly as he signed his contract.
Jones said Harden is his favorite player and was thrilled to get to spend time with him.
Magic: visit Dallas on Wednesday.
Rockets: host Nuggets on Thursday.