LOS ANGELES — The real playoffs haven’t even started yet, and the Los Angeles Lakers’ title defense has already survived its first major scare.

At the end of a choppy and discombobulated night that left him blurry-eyed, LeBron James drilled a go-ahead three-pointer in the final minute of regulation to deliver a thrilling 103-100 victory over the Golden State Warriors in a Western Conference play-in game.

Offensive rhythm and execution were hard to come by all night for the Lakers, and even James’s game-deciding moment was the result of a broken play. Kentavious Caldwell-Pope found himself in the paint with nowhere to go and seemingly no one to pass to before he found James well outside the arc.

With the shot clock ticking down, James stepped into a deep three-pointer from the Staples Center logo that swished through. A few possessions earlier, James had taken a foul to the face from Warriors forward Draymond Green that left him splayed out on the court and needing eye drops once he returned to the bench.

“I saw three rims,” James said after posting 22 points, 11 rebounds and 10 assists in 35 minutes. “I just aimed for the middle one. I practice enough at my game. Grace to the man above. . . . [Green’s] finger or thumb went directly into my eye. I was making sure I was okay and I wasn’t bleeding and that I could see so that I could finish the game.”

Hopes that the Lakers would immediately flip a switch after an injury-plagued season didn’t materialize, and the Warriors threw a big scare into them with pesky defense and a balanced scoring attack. Nevertheless, the Lakers survived to claim the West’s seventh seed and a first-round date with the Phoenix Suns.

Steph Curry and the Warriors now face a do-or-die game to claim the eighth seed against the Memphis Grizzlies at Chase Center in San Francisco on Friday, with the winner facing the top-seeded Utah Jazz in the first round. The Grizzlies defeated the San Antonio Spurs, 100-96, in the West’s other play-in game Wednesday.

“We’ll be ready,” said Curry, who scored 46 points to beat the Grizzlies on Sunday. “Right now, it sucks. . . . Walking in the locker room, guys are upset, angry, frustrated that we didn’t get the job done. We know [the Grizzlies are] going to come in with the same desperation we’re going to have. It’s the biggest game of the year.”

This was a “rabbit out of the hat” type of night for the Lakers, who fell into a 15-4 hole and didn’t lead until the fourth quarter. Plenty of warning signs accumulated early: James failed to hit the rim on consecutive first-quarter jumpers, a frustrated Anthony Davis received a technical foul for his role in a needless second-quarter argument, and Dennis Schröder struggled to find his rhythm after an extended absence in the NBA’s health and safety protocols.

There was real anxiety among the 6,000 socially distanced spectators in a crowd that included a spirited contingent of Warriors fans. After playing in an empty arena for much of the season, the Lakers took the court in front of the Laker Girls and a courtside celebrity row that included Drake, Michael B. Jordan and Naomi Osaka. The loud cheers of relief at the final buzzer made the building sound nearly full, and the tense nature of the contest was validation for the hotly debated play-in concept.

Chemistry is difficult to conjure instantly, and the Lakers displayed their lack of recent continuity throughout the first half. James missed six of his first seven shots, Davis missed eight of his first nine, and Schroder, the Lakers’ highest-profile offseason addition, missed his first eight. Midseason pickup Andre Drummond had a limited impact in the middle, and he was benched down the stretch in favor of smaller lineups. As Green stymied Davis’s ability to score inside, Andrew Wiggins held up well against James for much of the night.

“We had to remind ourselves at halftime: We’ve been here before,” Davis said. “We had to find our swag knowing that we’re the defending champs and nothing is going to be easy for us because we have a target on our back.”

James, who opened hesitantly in his fifth game since his return from a high ankle sprain, exerted greater control as the second half unfolded, and the Lakers used Davis more often at center. The reigning Finals MVP found a cutting Alex Caruso with a brilliant bounce pass late in the third quarter, and he bullied his way to the basket to open the fourth. Davis finally got going midway through the final quarter, finishing a lob from James and connecting on a pair of jumpers to finish with 25 points and 12 rebounds on 10-for-24 shooting.

“[Golden State has] been playing playoff basketball for a while, and we had to catch up to that,” James said.

Curry methodically picked his spots against a defense intent on slowing him down, and Wiggins delivered a strong performance in what was arguably the highest-stakes game of his career. Curry finished with 37 points, including six three-pointers; seven rebounds; and three assists. Wiggins chipped in 21 points, three rebounds and two assists, driving relentlessly to the hoop in the fourth quarter.

On the Warriors’ final possession, Davis and the Lakers ramped up their defensive pressure, denying Curry an opportunity to get off a game-tying three. Once the buzzer sounded, Curry embraced Davis and James in what will go down as a memorable battle.

“We continued to play great defense and were able to fight,” Davis said. “We were able to get stops and play our style of basketball, which ultimately got us that victory.”

The Lakers will now turn their attention to Game 1 on Sunday against the Suns, who earned the West’s second seed with steady, balanced and unselfish team play all season long. James will face off against his longtime friend Chris Paul, whose all-star pairing with guard Devin Booker catapulted the Suns up the standings and ended the franchise’s 10-year postseason drought. Expect a controlled series both ways, with Davis presenting matchup problems for Phoenix’s young front line.

For the upstart Suns, though, their primary challenge remains James, who enters the postseason on a high note following a challenging campaign.

“[James] proved he’s the best player in the world down the stretch,” Lakers Coach Frank Vogel said. “He hits that bomb to win it for us. Add it to his résumé.”

Ben Golliver

Read highlights of Golden State vs. L.A. Lakers below.

Read more on the NBA: