ORCHARD PARK, N.Y. — There was a point during the Eagles’ 14-play fourth-quarter touchdown drive — the push that settled the outcome Sunday — when Carson Wentz looked to the side to throw a third-and-10 screen, and Wentz realized that just wasn’t happening.

A blue-jerseyed defender was standing right there, in front of the receiver. Buffalo was starting to catch on to a weather-limited game plan, the Eagles running more screens than the TSA.

So Wentz tucked the ball and churned 11 yards, to the Eagles’ 46, and the chains moved.

This 31-13 mauling of the host Bills on a raw, rain-and-wind-scoured afternoon was the day the Eagles committed to doing whatever it took. They finally played with the desperate resolve they have been talking about for the last few weeks, while they were losing key NFC battles to Minnesota and Dallas by a combined score of 75-30.

“To do what we did today, to stay together throughout everything and come out and get a big win when it’s really difficult, that was huge,” Wentz said after the Eagles reached the midway point in their schedule at 4-4, becoming the first team other than New England to defeat the now 5-2 Bills.

After cornerback Orlando Scandrick was cut last week, he went on FS1 on Friday and ripped the Eagles organization, suggesting among other things that the locker room was self-satisfied.

“It’s a close locker room, and I think today was proof of that,” Eagles coach Doug Pederson said. He said he was proud of the way his players put aside distractions.

The team sent a signal to general manager Howie Roseman that the season is salvageable, as the NFL trading deadline Tuesday draws nigh.

Wentz, 6-foot-5, 237 pounds, came into the NFL as a quarterback who could use his legs as well as his arm, but that was a couple of season-ending injuries ago.

“You see the wheels on him out there?” right guard Brandon Brooks asked. “Just wanted to let everybody know his knee and his back’s fine, huh? … Throughout Carson’s career, one of the big positives about him is, he’ll make a big play out of nothing.”

“A lot of those guys are a lot faster than me. I do not want to run, ever,” said Wentz, who sprinted 13 yards on an option play to convert another third down on the same drive, which featured 10 runs and four passes and used up more than half the fourth quarter.

Wentz noted that a play had to be made, somehow, when the third-down screen broke down.

Pederson said that Wentz “played really tough today.”

That was the way the whole team approached its task, from Brandon Graham’s late first-half strip-sack and fumble recovery that led to the go-ahead touchdown, to Jordan Howard’s lead block on Miles Sanders’ 65-yard touchdown run, to Ronald Darby’s fourth-and-10 pass breakup, to the offensive line’s relentless pummeling of a well-regarded Buffalo defensive front for 218 rushing yards, on 41 carries.

“That’s what an offensive line is supposed to do,” Brooks said, when a reporter marveled at how the Eagles battered what had been the NFL’s third-ranked defense.

Center Jason Kelce took a break from pulling on his socks to chime in: “We’ve got a pretty good front, too!”

Right tackle Lane Johnson said it felt good to establish the run. It also felt good to get back indoors, with a victory, on a day when, at times, the sky seemed to literally be falling.

“It felt like I was on that raft with Tom Hanks in Castaway. Kelce was ‘Wilson,’ I guess,” Johnson said.

Wentz was efficient, completing 17 of 24 passes for 172 yards and a touchdown, and avoided turning the ball over.

“It’s really our recipe,” Wentz said of the running game, which also keyed the victory at Green Bay. “We just want to establish the line of scrimmage. The big guys we have up front, that’s one of their biggest strengths. … Everything else that we do — play-actions, bootlegs, nakeds — all that’s established when those guys control the line of scrimmage.”

Pederson showed Bills coach and former Eagles defensive coordinator Sean McDermott an occasional new run-game wrinkle, such as lining Howard and Sanders up in the backfield together on the first possession of the third quarter, then having Howard make like a fullback, blasting a hole for rookie Sanders to blaze through, all the way to the end zone from the Eagles’ 35. Sanders later left the game with a shoulder injury.

“That was sweet,” Wentz said. “The first thing I said to Miles, you better give [Howard] some love on that. … To have an explosive run like that, it’s been a while since we really broke a long touchdown run. … [Howard] did turn into a fullback right there.”

Johnson said: “The momentum started with that big gash by Miles, then after that, kept snowballing.”

The play of the game belonged to Graham, though.

The Eagles were trailing, 7-3, late in the second quarter and the offense was flailing. The defense was having trouble with Buffalo quarterback Josh Allen’s ability to take off when he couldn’t find a receiver. Sometimes Allen, who would lead the Bills with 45 rushing yards on eight carries, even took off on designed runs.

That was what Allen was doing on third-and-2 on the first snap after the two-minute warning. Graham said he had set up to slant inside but heard a teammate behind him — he thought it was Nate Gerry — yell “power, power,” alerting him to stay put.

Graham knocked the ball loose but ended up several yards away. Somehow, as it bounced around, he made his way back into the play and recovered the fumble.

“Just hustling, man. I saw the ball pop up. I was on my back at first,” Graham said. “That’s what they say, don’t stay on the ground too long. I’m just happy I was hustling and was able to do it when I did, because we needed that. It kind of sprung us forward.

“We ended up not looking back after that.”

The Eagles got the ball at the Bills’ 24, with 1 minute, 53 seconds left before halftime. Four runs and a 5-yard touchdown pass to Dallas Goedert later, they had the lead back, for good. Sanders’ two-point conversion run made it 11-7.

The second half was all about the Eagles’ run game. The defense gave up some frustrating third-and-long conversions but only one touchdown, with Derek Barnett blocking the extra point.

Howard’s 23 carries (for 96 yards) were the most of any Eagles back since Pederson was named coach.

Howard said he knew that when Sanders went down, he would have to take up the slack. Boston Scott scored his first NFL touchdown on a 4-yard run, as Sanders was going to the locker room and Howard was on the sideline recovering from a hit. But Scott, who later fumbled away a punt, didn’t get another try from scrimmage until the outcome was decided.

“No amount of carries is too much for me,” said Howard.

So, where does this leave the Eagles? Of course, they didn’t solve all their problems with a non-conference victory. They still have a lot of key players hurt — they might have added Sanders to that list — and their passing game, windy day or not, is far less potent at midseason than it was supposed to be when the season began.

“I don’t know what we showed. We were 3-4 and we needed a damn win. That’s really all it boils down to,” Johnson said. “It is what it is. It felt good to get one.”