LOS ANGELES — Here’s why the Eagles stunned the Rams, 30-23, on Sunday night.

Situational defense

Jim Schwartz’s defense hasn’t been very good on third down lately. In the previous seven games leading to Sunday night, opponents had converted 45.2 percent of their third-down opportunities, the fifth-worst third-down rate in the league over that period. The Eagles had allowed the Cowboys to convert 10 of 19 third-down opportunities last week.

But they buckled down against the Rams, who entered the game ranked eighth in third-down offense but converted just four of 12 chances against the Eagles.

The Rams converted two of their first three third-down opportunities, then only two of their last nine. Jared Goff completed just five of 11 third-down passes for 63 yards. He was sacked once, by Fletcher Cox on a third-and-11 in the red zone, and threw that wacky third-quarter fumble/interception that set up the Eagles’ game-winning touchdown.

The Eagles' defense was even more impressive in the red zone. The Rams had six red-zone opportunities Sunday, but made it into the end zone just twice. Goff was just 2-for-10 for 13 yards with no TDs and a sack in the red zone.

Foles to the rescue

Armed with a game plan built around his strengths, Nick Foles stepped in for injured Carson Wentz and turned in a solid performance.

Rust? What rust? Foles completed 24 of 31 passes – some short, some long – for 270 yards. He didn’t have a touchdown pass, but except for that early fourth-quarter interception, didn’t make many mistakes, either.

He kept the Rams' defense off balance with RPOs and a productive ground game. He gave Alshon Jeffery some chances on 50-50 balls downfield, something Wentz often seems reluctant to do.

He hit seven receivers. He wasn’t sacked and didn’t hold the ball too long. And while he took a few vicious shots from Rams pass rushers who were eager to see Nate Sudfeld, he kept getting back up and completing passes.

The run game

With or without Carson Wentz, the Eagles knew they couldn’t get into a 50-pass shooting match with the Rams. They had to, as right tackle Lane Johnson so aptly put it, stay balanced. And they did.

The Eagles ran the ball 30 times and threw it 31 in Sunday night’s win, about as balanced as you’re going to get.

They averaged an unremarkable 3.7 yards per carry, but they were productive with their runs. They had three rushing touchdowns for the first time since 2016. They had seven rushing first downs.

Wendell Smallwood, who was buried on the bench and had just four carries in the previous five games, stepped in early in the second half after Josh Adams injured his back and had two touchdowns as the Eagles rattled off 17 unanswered points in the third quarter to take a 30-13 lead. Smallwood finished with 48 yards on 10 carries.

The Eagles ran a lot out of “12” personnel, which the Rams opted to defend with their five-DB sub-package. It helped them keep tight end Zach Ertz under control but didn’t help them stop the Eagles' ground game.

“They went nickel the entire game to 12 personnel,’’ said Ertz, who had key blocks on two of the Eagles’ three rushing TDs. “That is going to present a lot of opportunities to run the football.’’

Doug had ‘em ready

It had been a tough week for the Eagles. They lost an overtime heartbreaker to the Cowboys that realistically eliminated their hopes of winning the NFC East. Then they lost their starting quarterback.

They lugged a 6-7 record and their very slim playoff hopes across the country to play an 11-2 team that nobody gave them a chance in hell of beating. It would have been easy for them to have mailed it in Sunday night. I guarantee you a lot of teams in their situation would have done it. But they didn’t.

Doug Pederson was a big reason. Pederson understands his players and knows what makes them tick. They respond to him. The ex-player thing works.

He knew how to keep them from quitting in his first season as head coach in 2016 when they lost five in a row. And he knows how to keep them fighting and playing hard now with a Super Bowl ring already in their jewelry drawer.

He did a masterful job, along with offensive coordinator Mike Groh, of putting together a game plan that suited Foles. He stuck with the run.

And he trusted his defensive coordinator, Jim Schwartz, to find a way to keep the high-scoring Rams from flying up and down the field.

Short and sweet

With the exception of yet another white-knuckle fourth quarter, Schwartz’s defense did a very good job against Jared Goff and the Rams’ passing game.

Rookie Avonte Maddox returned after missing three games with a knee injury, started at one of the outside corner spots, and had a second-quarter interception.

With Maddox and Rasul Douglas on the outside and Cre’Von LeBlanc in the slot, the Eagles focused on keeping the ball in front of them and limiting the Rams’ yards after catch. They had a few slip-and-falls, but for the most part they did a nice job. Goff had just one completion longer than 20 yards.

Through three quarters, Goff was averaging just 5.5 yards per attempt. Robert Woods had just four catches for 48 yards. Brandin Cooks had five catches for 39 yards; Josh Reynolds, two for 15 yards.

The Eagles had only one sack, but their front four did a nice job of getting consistent pressure. And while Schwartz called very few blitzes, the ones he did call, including one on the Rams’ last play of the game from the Philadelphia 18, were effective.