DETROIT (AP)LeBron James scored 35 points, Anthony Davis had 34 points and 15 rebounds and the Los Angeles Lakers beat the Detroit Pistons 124-117 on Sunday night.

”This was a must-win for us, because we wanted to have a successful road trip – at least .500,” Davis said. ”The last game is always the toughest to win.”

Davis also had seven assists as the Lakers overcame 38 points from Bojan Bogdanovic to end a three-game losing streak. Lonnie Walker IV added 18 points for Los Angeles and Russell Westbrook had 11 points and nine assists.

”LeBron really came in with a focus to finish the right way,” Lakers coach Darvin Ham said. ”He was leading the charge and would not allow this game to get away from us.”

Rookie Jaden Ivey had 16 points for Detroit. The Pistons have lost three in a row.

”There are a lot of things you can’t control in a game – they came in shooting 28% on threes and they shot 42% tonight – but we have to get better at the other things,” Pistons coach Dwane Casey said. ”We can control boxing out and understanding rotations – we get caught up in the game and lose our focus.”

The Lakers led 61-49 at halftime, but Bogdanovic scored a career-high 25 points in the third quarter to pull the Pistons back into the game. With Davis scoring 17 points in the quarter, the Lakers took a 91-90 lead into the fourth.

”We fought all night long, but I think we had too many mistakes in the first half,” Bogdanovic said. ”We must have given them 10 easy back-door layups and dunks, and that breaks your defense.”

Alec Burks scored to pull Detroit to 119-115 with a minute left, and Bogdanovic’s layup made it 119-117 with 35 seconds to play.

James, who had 13 points in the fourth, ran down the clock, drove down the lane and flipped to an open Austin Reaves for a baseline 3-pointer with 12.4 seconds to play.

”When you are playing with him, you know he’s always going to make the right basketball play,” Reaves said. ”Knowing he has the confidence in me to take that shot builds my confidence.”

Casey was left shaking his head at another key mistake by his young team.

”I’m not even sure who it was, but our defender in the strong corner helped into the lane on LeBron,” he said. ”You can’t do that. You have to understand the situation. If we give up a basket at the rim, we live with it, but you can’t give up a three at that point.”

TIP INS

Lakers: James and Davis had two of their most famous performances at Detroit’s previous arena, the Palace of Auburn Hills. James scored 48 points, including Cleveland’s final 25, in an overtime win in Game 5 of the 2007 Eastern Conference Finals. Nine years later, Davis had 59 points and 20 rebounds to help New Orleans beat the Pistons 111-106 on Feb. 21, 2016.

Pistons: Rookie Jalen Duran made his only field-goal attempt in his second start, finishing with three points and 13 rebounds in 23:42.

LAKERS VS. CELTICS

With the Lakers heading home to host Boston – the NBA’s most historic rivalry – Ham was left shaking his head about his memories of the two franchises facing off.

”I hated both those teams,” said Ham, who grew up about 90 minutes north of Detroit and won the 2004 NBA title with the Pistons against the Lakers. ”We hated the Lakers, the Celtics and the Bulls.”

UP NEXT

Lakers: Host Boston on Tuesday night.

Pistons: At Charlotte on Wednesday night.

More AP NBA: https://apnews.com/hub/NBA and https://twitter.com/AP-Sports