When the New York Giants were sitting at 2-3, it appeared as though all of their offseason changes were for naught. Three straight wins later, they’re in the driver’s seat in the NFC wild-card race.

Quarterback Eli Manning threw for four touchdowns, wide receiver Odell Beckham Jr. caught two and the Giants defense made a critical late stop to earn a 28-23 win over the Philadelphia Eagles on Sunday. The Giants are now in sole possession of second place in the NFC East—not that they made it easy on themselves.

A late Manning interception set the Eagles up deep in Giants territory, with Philadelphia needing a touchdown to take the lead. Rookie signal-caller Carson Wentz drove his offense to the Giants’ 17-yard line but then threw four consecutive incompletions to turn the ball over on downs.

Skip Bayless of Fox Sports 1 commented on the game:

Giants survive. Eagles fall to 4-4. Will Doug Pederson keep comparing Wentz to Peyton and Favre?

— Skip Bayless (@RealSkipBayless) November 6, 2016

The Giants, who seemed to be on the verge of collapse when Beckham was fighting kicking nets, now appear to be in a rhythm. Manning has thrown for eight touchdowns in his last four games, Beckham has five scores over the same stretch and the defense has looked good while employing a bend-but-don’t-break strategy.

The team provided a clip of Beckham’s first score:

— New York Giants (@Giants) November 6, 2016

New York picked off Wentz two times, atoning for the fact that Philadelphia moved the ball throughout the game. The Eagles outgained New York 443-302 and held possession for nearly 33 minutes but could not get out of their own way. Wentz’s two interceptions led to 14 first-half points for the Giants, who also blocked an Eagles field-goal attempt.

ESPN Stats & Info provided some unfortunate news for Philadelphia:

Carson Wentz is the 1st player this season to throw interceptions on his team’s 1st 2 drives of a game

— ESPN Stats & Info (@ESPNStatsInfo) November 6, 2016

ESPN’s Trey Wingo thought some of the blame should have fallen on Eagles head coach Doug Pederson:

Doug Pederson did a great job calling plays for Wentz early in the year.. but his calls and decisions today are pretty brutal

— trey wingo (@wingoz) November 6, 2016

It wasn’t all bad news for Wentz, who threw for 364 yards and completed 27 of his 47 attempts. In the process, he set a franchise record for passing yards by a rookie. Tight end Zach Ertz recorded a game-high eight receptions for 97 yards.

Wentz is nonetheless working through a rough stretch of football. After throwing for seven touchdowns with just one interception in his first four starts, Wentz has tossed only two scores and four picks in his last four. He has not had a multi-touchdown game since Week 5.

The season has gone in the opposite direction for Manning, who struggled early but seems to be rounding into form. Sunday was the 14th time in his career that Manning has thrown for four or more touchdowns in a game.

Two of Beckham’s four grabs went for scores, and he finished with 46 yards. Sterling Shepard led the way for the Giants with 50 yards on three receptions, including a third-quarter score that served as the Giants’ final touchdown. Roger Lewis hauled in Manning’s other touchdown pass.

Now sitting at 5-3, the Giants are alone in the top wild-card spot, though the Green Bay Packers can join them with a win over the Indianapolis Colts later Sunday. Only the Dallas Cowboys (7-1) and Seattle Seahawks (4-2-1) have fewer than three losses in the NFC, which makes the conference wide-open.

With New York hosting the Cincinnati Bengals and Chicago Bears over the next two weeks, they could be sitting at 7-3 before going back on the road.

The Eagles, meanwhile—losers of three of their last four games—are alone in last place in the division at 4-4. They’ve lost four of their five games on the road but will return home for next Sunday’s tilt with the Atlanta Falcons.

Follow Tyler Conway (@jtylerconway) on Twitter.