PHOENIX -- The Suns took a unique approach to guarding LeBron James, putting 7-foot-1 center Deandre Ayton on him.

James got his numbers, but the Suns frustrated the Los Angeles Lakers star and were able to push back when he tried to lead a late charge.

Ayton had 26 points, 10 rebounds and primary defensive duties against James, helping the Suns hold off the Lakers 118-109 on Saturday night.

"That was a fun game," Ayton said. "I'm going to sleep well tonight."

Phoenix lost the first three games this season against Los Angeles by double digits, but the Suns had the Lakers a bit discombobulated through three quarters in the season series finale.

The Suns' defense on James, led by Ayton, helped. The four-time league MVP was frustrated at times with Phoenix's defense and his team's inability to hang with the NBA's worst team.

But as he has so many times, James tried to lead the Lakers back.

With Los Angeles trailing by 14 with 6:06 left, James scored on a three-point play, hit a 3-pointer and kicked out to Brandon Ingram for a corner 3 on the break. He followed with a dunk off a baseline drive to get the Lakers within 112-109.

Los Angeles got no closer, losing a game it couldn't afford to lose while fighting for a playoff spot. It dropped 4½ games out of the eighth spot in the West with just 19 regular-season games left.

"We needed this game for obvious reasons," said James, who had 27 points, 16 assists and nine rebounds. "It is just unfortunate with the opportunities we've had that we haven't been able to seize the opportunity."

Phoenix, which entered the game an NBA-worst 12-51, is the worst team James has lost to while playing in his NBA career (minimum 25 games into a season), according to ESPN Stats & Information.

The Suns appeared as if they would wilt down the stretch, as they had done so many times. Instead, Phoenix shut down the Lakers and made six free throws in the final 52 seconds to win for the second time in three games following a 17-game losing streak.

Devin Booker added 25 points for the Suns.

"We showed we can close games, execute in crunch time, having enough discipline," Suns coach Igor Kokoskov said. "They were coming hard at us."

Both teams were in the second game of a back-to-back. The Lakers lost 131-120 to Milwaukee after the Bucks closed the game on a 15-2 run. The Suns followed their first win in six weeks with a 130-116 loss to New Orleans, allowing the Pelicans to hit 16 3-pointers and shoot 67 percent in the second half.

The Lakers won the most recent meeting against Phoenix 116-102, despite playing without James, Lonzo Ball and Kyle Kuzma.

The Suns got off to a much better start Saturday, leading by 10 and making 13 of 19 shots in the first quarter.

Phoenix stretched the lead to 14 early in the second quarter, but Los Angeles used a late run to pull within 66-59 by halftime.

The Suns continued to frustrate James and the Lakers in the third quarter, stretching the lead to 95-78 behind Booker's 12 points.

Midway through the fourth quarter, James led a push, but the Suns shoved back.

"We need to be better. We need to be a lot better," Lakers coach Luke Walton said. "I am happy with the fight we showed in the fourth quarter, but where we are at in the season, that is the desperation that we need to start the game with."

McGEE'S LIFT

Looking for a boost after Ayton dominated early, Walton turned to 7-footer JaVale McGee. He responded by hitting all 10 of his shots while scoring 21 points and grabbing seven rebounds.

TIP-INS

Lakers: Ball missed his 16th straight game with a bone bruise and sprained left ankle suffered in a collision with Houston's James Harden on Jan. 19. ... James passed Kobe Bryant (11,719) for fifth on the NBA's all-time field goals list. He made 10 against the Suns, giving him 11,726. ... Lance Stephenson missed his second straight game with a left foot sprain. ... Rajon Rondo had four assists and passed Deron Williams (6,819) for 20th on the NBA's all-time assists list.

Suns: Phoenix had a rough night from the 3-point arc, going 6-for-26, but made 66 percent of their two-point shots. ... The Suns are 1-9 on the second game of a back-to-back. ... Phoenix made 34 of 40 free throws, both season highs.

UP NEXT

Lakers: Host the LA Clippers on Monday.

Suns: Host the Bucks on Monday.

Information from The Associated Press was used in this report.