CHARLOTTE, N.C. — Puka Nacua stepped into the offensive huddle with the Los Angeles Rams trailing by four points on the road and 2:38 left in the game, the home fans at Bank of America Stadium roaring and his team’s season on the line.

Nacau never thought twice about losing.

“Never a doubt; No. 9 is with us,” the 24-year-old receiver said with a wide smile in reference to the team’s 37-year-old quarterback, Matthew Stafford, a three-time Pro Bowl selection who hours earlier was named to the AP All-Pro team for the first time.

Stafford calmly led the visitors 71 yards by completing six of seven passes — the only incompletion a drop by Davante Adams — before capping it with a perfectly placed 19-yard touchdown strike to 6-foot-7 tight end Colby Parkinson with 38 seconds left, lifting the Rams to a dramatic comeback win over the Carolina Panthers, 34-31, in the opening game of the NFL playoffs Saturday.

Stafford finished 24-of-42 passing for 304 yards with three touchdowns and an interception, while Nacua had 10 catches for 111 yards and scored two touchdowns as the NFC’s fifth-seeded Rams (13-5), who were 10 1/2-point favorites, advanced to next weekend’s divisional round.

“You see him out there, he just has the best composure of anyone I have ever seen,” Parkinson said. “He knows that we are going to go make it happen, and we completely trust him. … I knew he was going to have to throw a back-shoulder ball — and that was a perfect ball. Like perfect. It couldn’t have been placed any better.”

Stafford credited his calmness to his 17 years of NFL experience, which includes leading the Rams to their most recent Super Bowl championship to cap the 2021 season, his first with Los Angeles after 12 with the Detroit Lions, who took him with the No. 1 pick of the 2009 draft.

“I have been in that spot a lot in my life — and I love that spot,” Stafford said. “I would rather be me having to go out there with our offense and do it then watch from the sideline. You can make it stressful, or you can make it calm and collected, and think the latter is what we were today.”

Bryce Young threw for 264 yards and a touchdown and ran for another score for fifth-seeded Carolina (8-10), which was a division champion in the NFC South — where all four teams had a losing record — but finished its second season under coach Dave Canales by losing four of its final five games, including Saturday’s wild-card playoff matchup.

Jalen Coker had career highs with nine receptions for 134 yards with a touchdown, and Chuba Hubbard ran for 46 yards and two touchdowns as the Panthers lost in their first postseason appearance since the 2017 season.

“There is such a mix of emotions right now in the locker room, from guys being proud of what we accomplished and where we got, to being sick about the opportunity that was right there in front of us,” Canales said. “And that is going to sting.”

The Panthers, who beat the Rams 31-28 on the same field six weeks earlier in the regular season, fell behind 14-0 early in the rematch but stormed back to take a 24-20 lead on Hubbard’s second touchdown of the day game early in the fourth quarter.

Stafford, who was the All-Pro roster’s first-team quarterback, led the Rams back down the field and found Kyren Williams for a 13-yard touchdown to regain the lead.

AP photo by Erik Verduzco / Los Angeles Rams quarterback Matthew Stafford passes during Saturday's NFL wild-card playoff game against the Carolina Panthers at Bank of America Stadium on Saturday in Charlotte, N.C.AP photo by Erik Verduzco / Los Angeles Rams quarterback Matthew Stafford passes during Saturday’s NFL wild-card playoff game against the Carolina Panthers at Bank of America Stadium on Saturday in Charlotte, N.C.

Los Angeles appeared to be in charge after getting a stop on defense, giving Stafford the ball back, but a holding penalty put the Rams behind the sticks and forced a punt, which Isaiah Simmons blocked to set the Panthers up at the Rams’ 30-yard line.

Four plays later, Young found Coker in the left corner of the end zone for a 7-yard touchdown to give Carolina a 31-27 lead with 2:39 left, sending the crowd into a frenzy.

The celebration quickly turned to silence after Stafford gave the Rams the lead again.

Carolina’s last attempt to move into field-goal range ended when Jimmy Horn dropped a fourth-down pass from Young.

“Yeah, total team effort,” said Stafford, a leading candidate for NFL MVP after leading the league in passing yards and touchdowns. “Obviously had some mistakes along the way. I turned it over, we had a punt blocked, didn’t score before the half when we probably should have. So a lot to clean up, but found a way to win it late.”

Carolina was hoping the return of former quarterback Cam Newton, who led the franchise to Super Bowl 50 a decade ago, to hit the “Keep Pounding” drum before the game would give the Panthers a little extra mojo early, but things didn’t start well.

After the Los Angeles defense came up with a stop on fourth down at midfield on Carolina’s opening drive, Stafford quickly moved the Rams downfield and found Nacua over the middle for a 14-yard touchdown.

Nacua made it 14-0 on a 5-yard run after Young’s interception.

Carolina cut the lead 17-14 heading to halftime after a 1-yard touchdown run by Hubbard and a 16-yard scramble by Young, the second-longest touchdown run of the former No. 1 draft pick’s three-year pro career.

The Rams had a chance to build on the lead, but Nacau dropped a potential third touchdown on a pass down the right sideline from Stafford just before halftime.

Los Angeles coach Sean McVay admitted it wasn’t his team’s best effort and there is plenty to clean up before the next game.

“We are going to need to be able to play better if we expect to advance,” said McVay, who has led the team to the playoffs in seven of his nine seasons.

Rams defensive lineman Kobie Turner said rectifying those mistakes is something that can be addressed Sunday.

“There are no style points in the playoffs,” Turner said. “It’s all about survive and advance.”