EAST RUTHERFORD, N.J. — Brandon Graham talked a few days back about what the Eagles would have to do “if we want the hat, want the T-shirt.”

Sunday evening, Graham was wearing the hat — spoiler alert, it said “NFC East Champions” — and awaiting the T-shirt, in the visitors’ locker room at MetLife Stadium, following a 34-17 victory over the New York Giants that clinched the division title. It also set up a home-field wild-card round playoff game Sunday against the Seattle Seahawks at 4:40 p.m.

Really, though, Graham had no idea how high and how slippery the hill was that his 9-7 team would have to climb Sunday, losing two more of its very best players, Brandon Brooks and Miles Sanders, and deadlocked with the four-win Giants heading into the fourth quarter.

“We had to dig deep, because, man, 17-17, we could have folded. The pressure is on,” said Graham, who finished the season with 8.5 sacks after contributing one of the four the Eagles notched against Giants quarterback Daniel Jones.

“We could’ve started going at each other, especially on the [68-yard Saquon Barkley touchdown run that tied the score at 17]. I just love how we handle adversity. I think that tells you a lot about your team. I think we did a great job today.

“I felt like we earned it. We just kept coming.”

The key play, after Jake Elliott drove a 50-yard field goal through the cold rain to restore the lead at 20-17, was Malcolm Jenkins’ forced fumble and Fletcher Cox’s recovery at the Giants’ 2. That sequence set up a 2-yard Boston Scott touchdown run with 13 minutes left that gave the Eagles their first double-digit lead, and convinced the Giants they weren’t going to pack up their belongings on an up note.

Jones fumbled a low Giants snap. It bounced off Barkley’s ankle, back to the rookie quarterback. As Jones worked to put the ball away, Jenkins pried it from his grasp. It was the sort of thing Jenkins tends to do in important moments.

“I just saw him bobble it, and before he could get possession, I just tried to punch it out,” said Jenkins, who was blitzing. “Fletch did a good job of scooping it up.”

Jones chased the bouncing ball back toward his goal line, pursued by a pack of desperate Eagles. Cox won the race.

“I saw him trying to run out there and get on it, but I pushed him out of the way,” Cox said. “Jim [Schwartz] called a play. My job was to get outside. I got outside and somebody got the ball out. I saw the ball on the ground. The most important thing for me was to get the ball.”

The other starting defensive tackle, Timmy Jernigan, said: “That changed the game. … That’s just Fletcher. He’s a dog, he’s a playmaker.”

The four-game winning streak that took the Eagles from 5-7 after a Dec. 1 loss at Miami to the division title wasn’t pretty, but it was gritty.

“It means a lot to this organization. It means a lot to the fans. It just means a lot to us,” Cox said. “In the last four weeks, everybody’s been focused. We got a lot of guys down … with guys stepping up, to me, I think it’s bringing guys that much closer.”

Carson Wentz became the first quarterback in NFL history to throw for more than 4,000 yards without a wide receiver totaling 500 yards. He finished Sunday’s game a hard-won 23-for-40 for 289 yards, without any of his three normal starting wide receivers or his leading receiver, Pro Bowl tight end Zach Ertz, who might be sidelined for the playoffs with rib and kidney injuries.

Wentz was without his remaining best weapon, running back Sanders (ankle), for more than half the game. This also was the case with Brooks, the three-time Pro Bowl right guard, who left on a cart after suffering a shoulder injury blocking for a second-quarter extra point.

The Eagles who weren’t being ushered into the blue tent Sunday or carted down the tunnel fought all the way, against a Giants team that they had beaten six times in a row and 10 of 11 going into Sunday, a team that had nothing to play for.

The Dallas Cowboys could have made it easy by losing to visiting Washington, but they most emphatically did not do that, winning, 47-16.

The Eagles had to win or tie, to make the playoffs for the third year in a row.

“This team has really come together really well through all the adversity, through all the struggles, through all the injuries,” center Jason Kelce said. “It’s a testament to the guys in this room, a testament to the coaches. This thing could have obviously gone a much different way, but we’ve really stayed true to who we are. … I think all of this has definitely made us closer.”

Wentz has made it healthy to the postseason for the first time in his career. His reward is that he will have to find a way to win while missing somewhere around 10 starters.

On Sunday, Wentz’s leading receiver was running back Boston Scott, who became the running back after Sanders went down. Jordan Howard, back from a six-game absence with a shoulder injury, apparently was available only in an emergency.

Wentz found recent practice squad alumnus Deontay Burnett for a 41-yarder, the play after an identical long heave to another practice squad vet, Rob Davis, was negated by a holding penalty on Halapoulivaati Vaitai. Vaitai, you’ll recall, was playing because Lane Johnson was out with a high ankle sprain.

Wentz threw across his body, 24 yards to the end zone for the first touchdown of the day, to former practice squad tight end Josh Perkins. Perkins has one other NFL touchdown to his credit, for Atlanta in 2016.

“It’s just fun to see guys showing up in big moments like that,” Wentz said. “Guys just keep stepping up. … The journeys that a lot of them have been on I think makes it sweeter.”

Later in the fourth quarter, Scott spun and darted 39 yards with a screen pass, setting up another 2-yard touchdown run. This was the first three-touchdown game of Scott’s 13-game NFL career, which began after the Eagles plucked him from the New Orleans practice squad last season.

When buried-and-revived Eagles corner Sidney Jones intercepted a late Jones pass, the celebration was on in the seats for several thousand Eagles fans who braved the New Jersey Turnpike. They joined with the few remaining, soggy Giants fans in an ecumenical chanting of “Dallas Sucks.”

Several Eagles lauded the leadership of Wentz and Jenkins, and of Eagles coach Doug Pederson, who had to somehow fashion an offense out of spare parts.

“It was quite the season for us … a lot of ups and downs,” Wentz said. “The way we responded late in the year with our backs against the wall, to do what we did and to get in this moment [was tremendous], but we’re still hungry.”

Pederson described a postgame locker room filled with music and dancing, but also with a focus on next week, the next step.

He said his biggest task was “keeping everybody on the same page.”

“Leaning on the leadership of the football team and the veterans, and leaning on the coaching staff, and just trusting,” Pederson said. “In this business, we have to trust a lot of people, and that’s what I’m most proud about.”