Joey Slye kicked five field goals, helping first-year Carolina Panthers coach Matt Rhule to his first NFL victory in a 21-16 win against the host Los Angeles Chargers on Sunday at SoFi Stadium in Inglewood, Calif.

The result snapped the Panthers’ 10-game losing streak that extended to last season. It also allowed Carolina (1-2) to avoid what would have been the fifth 0-3 start in franchise history.

Panthers quarterback Teddy Bridgewater was 22-for-28 for 235 yards and a touchdown.

Chargers rookie quarterback Justin Herbert, in his second start in place of an injured Tyrod Taylor, went 35-for-49 for 330 yards with a touchdown and an interception.

Herbert threw a 14-yard third-down touchdown pass to Keenan Allen with 4:33 remaining. A two-point conversion pass was dropped by Allen, leaving the score 21-16.

The Chargers regained possession with 1:46 left, needing to cover 99 yards for a go-ahead score without a timeout. They reached the Carolina 23 before a penalty, an incompletion and a botched lateral on a trick play ended the game.

Allen had 13 catches for 132 yards.

Los Angeles (1-2) took the reigning Super Bowl champion Kansas City Chiefs to overtime a week earlier before falling.

Slye was 5-for-5 on field goals, hitting from 29, 24, 30, 22 and 31 yards. He connected on another one, but that was taken off the board late in the second quarter because the Chargers were flagged for an illegal defensive alignment penalty.

On the next play, Bridgewater’s screen pass to Mike Davis turned into a 13-yard touchdown. That extended Carolina’s lead to 15-7, with the extra-point kick blocked.

The Panthers added a Slye field goal on the last play of the first half. That was set up when Donte Jackson intercepted Herbert and made a 66-yard return to the Los Angeles 8 with eight seconds left.

The Chargers, who committed three first-half turnovers, scored their first touchdown on a 12-yard run from Austin Ekeler on the second play of the second quarter, completing a 10-play, 75-yard drive. Los Angeles scored the only points in the third quarter on Michael Badgley’s 41-yard field goal.