LOS ANGELES — Yes, yes, Nick Foles, but the Eagles’ battered, beleaguered defense played a huge role in the biggest victory of the season, 30-23 Sunday night over the host Los Angeles Rams.

It came down to second-and-10 from the Eagles' 18 with four seconds left, Los Angeles Rams quarterback Jared Goff flinging the ball to the end zone with blitzing Eagles linebacker Nate Gerry coming in hard, the ball flying past intended receiver Josh Reynolds, well covered by Avonte Maddox. Game over.

Jim Schwartz’s unit finally got some help from the offense, in terms of points (second-highest total of the season) and in terms of time when the defenders weren’t on the field (the Eagles held it for 31:36) against the offensive machine that has dominated the NFC West this season.

“A last shot at the end zone, and Avonte was in good position,” said Eagles coach Doug Pederson, who said he thought the blitz might have forced Goff to throw before he wanted. Pederson said his team “came out aggressively.”

“I knew they were going for the end zone, We played on the goal line,” Maddox said. "Looking at the quarterback the whole time, I saw him loading up to throw it [toward the right corner]. Just, get back there and make a play."

Maddox said he learned he would be playing outside corner on Friday. He hadn’t done it before in the NFL.

“When I’m out there, I want ‘em to throw the ball my way, so I can make a play," Maddox said.

“He’s a smart guy,” Pederson said of Maddox, who has played nickel corner, safety and outside corner as a fourth-round rookie from Pitt.

The Eagles were helped by Goff’s inaccuracy and by an amazing break: when the Rams were threatening late, Rams punt returner JoJo Natson just dropped a Cam Johnston offering, Tre Sullivan swatting at the ball as Natson tried to bring it back to him, the Eagles’ D.J. Alexander recovering. That misplay ended up taking a minute and 50 seconds off the clock, from 3:03 left to 1:13, and even though Jake Elliott was short and to the right with a 53-yard field goal that would have iced it, the Eagles’ defense held strong.

The Rams’ offense entered the evening second in NFL offensive yards per game (422.5) and third in points per game (32.7). It seemed quite possible the limping Eagles would suffer an embarrassment in the range of that 48-7 loss at New Orleans on Nov. 18.

Starting corner Ronald Darby is on IR. Starting safety Rodney McLeod is on IR. Middle linebacker Jordan Hicks hasn’t played since suffering a calf injury against New Orleans. Rookie defensive end Josh Sweat is on IR. Second-year starting corner Sidney Jones is out again with a hamstring problem.

A three-and-out on the first possession of the evening set the tone, especially Malcolm Jenkins’ tackle of Todd Gurley for a four-yard loss on the first snap.

Second defensive series — after the Eagles established a 3-0 lead with only their fourth first-drive score of the season — did not go nearly as well. The Rams drove 80 yards in 13 plays, Gurley scoring from 5 yards out and Fletcher Cox leaving the field and eventually heading to the locker room on a cart, with a hip injury.

» SOCIAL MEDIA ROUNDUP: What they’re saying about Eagles-Rams

Defensive end Daeshon Hall, an Eagle only since Tuesday, got some early snaps and was on for the touchdown, the former Panthers’ third-round pick easily swept aside.

But Cox missed only one series; he came back to notch the visitors' only sack of the night, and the Eagles were done giving up touchdowns for a good while. Their new starting corner combo of Maddox — back from a three-game knee and ankle injury absence — and Rasul Douglas was as solid as any outside corner grouping the team has fielded this season. The middle was softer, but the Rams had a hard time getting big chunks of yards that way.

“He’s the straw that stirs the drink for us, especially on third down,” defensive end Chris Long said, when asked about Cox’s return. "He creates so many opportunities for other people, and he works his ass off every day."

Goff, the guy drafted first overall in 2016, just ahead of Carson Wentz, seemed really bothered by a pass rush that looked considerably peppier than it has in many games this season.

“We was gettin' back there today,” defensive end Brandon Graham said.

“They were in seven-man protection a lot. We didn’t have a bunch of sacks, but I feel like we affected the quarterback,” Long said. “If they’re going to stay in seven-man, and they’re going to chip out, it affects a really potent offense,” making big plays harder to come by, with fewer receiving options. “People know that we can rush. The numbers aren’t always going to be there for us, but we’re going to hit him, and we’re going to affect him.”

With the clock ticking down toward two minutes remaining in the third quarter, Goff tripped over his center as he pulled away, on third and one. Instead of going down and taking the loss, he tried to throw the ball as he fell. Corey Graham intercepted and ran it to the Rams’ 12. Two plays later, Wendell Smallwood followed Jason Peters’ block into the end zone, and the Eagles led, 30-13.

“It was third down, down in the game, and [I] tried to make a play,” Goff said after completing 35 of 54 passes for 339 yards, no touchdowns and the two picks, for a 66.8 quarterback rating.

The defense survived a big challenge early in the fourth quarter when Foles threw an interception to Aquib Talib, covering Zach Ertz. The home crowd stirred to life. But Goff needed 10 plays to move the Rams 46 yards for a 37-yard field goal that made it 30-16 with 9:24 remaining in regulation. He threw behind receivers, most notably on what would have been a touchdown, Gerald Everett having gotten past Kamu Grugier-Hill, and on the third-and-13 before the field goal, Goff missing Gurley at the goal line.

Gurley left the game briefly in the third quarter with a knee injury, and whether it was the injury or the Eagles’ defense, the second-half Gurley did not look like the guy who ran 10 times for 49 yards in the first half, and caught five passes for 39 more. He ran twice in the second half, losing a yard, finishing with 12 carries for 48, along with 10 catches for 76. He came into the evening as the league’s second-leading rusher, with 1,203 yards on 244 carries. The Eagles came in tied for fourth-worst in the NFL, giving up 4.9 yards per carry.

“The team that wins the line of scrimmage usually wins the game, and today, we just had to make sure we stopped Gurley,” Graham said. “They didn’t do enough to beat us.”

The Eagles’ pass rush wore down late, and Goff got less skittish. On third-and-10 from the Eagles’ 34, just after another throw behind an open receiver, he lasered a strike to Reynolds, who had gotten inside Douglas over the middle. Douglas made the tackle just short of the goal line, with 4:13 left. It was the Rams' longest gain of the game. Two plays later, Gurley ran it in and it was a one-score game, 30-23.

At that point, the Rams had just five rushing first downs, and they were four for 12 on third down, even after the big play to Reynolds. They did not have another lightning strike in them, it turned out.

“I feel like we’ve been disrespected a lot this year, rightfully so at times,” Long said. “This team, as what it is now, we’re dangerous, we feel like.”

Get insights on the Eagles delivered straight to your inbox with Early Birds, beat writer Zach Berman’s newsletter for Eagles fans. Click here to sign up.

Our mission is to provide top-notch coverage for the best fans in sports. We can’t do it without your support. Join us: philly.com/birds