PHILADELPHIA -- Jamal Agnew quickly made up for two fumbles and the defense stepped up for Detroit when special teams almost blew it.
"It's good to get wins not playing your best football," Stafford said. "We're not playing our best, we kept battling. Finding ways to win as you're getting better as a team is a good thing."
The Eagles had a chance after Malcolm Jenkins blocked Matt Prater's 46-yard field goal try with 1:53 left. Rasul Douglas returned it to the Lions 22, but an illegal block on Jenkins pushed it back to midfield.
On fourth-and-5, Darren Sproles caught a pass for a first down but got called for Philadelphia's third offensive pass interference. Wentz's deep pass to J.J. Arcega-Whiteside fell incomplete with 41 seconds left. The rookie receiver said he should've caught it.
"It's the moment you ask for and dream about," Arcega-Whiteside said. "I gotta make the play."
The Lions (2-0-1) remain undefeated and the Eagles (1-2) have lost two in a row.
Agnew got Detroit started by going the distance after Philadelphia jumped ahead 3-0. He atoned for mistakes in the first two games.
"I owe it to my teammates and the coaching staff for sticking with me," he said.
Lions coach Matt Patricia sensed Agnew would breakout.
"He was working and he was grinding," Patricia said. "Give him all the credit in the world."
Jones had six catches for 116 yards, including a 12-yard TD reception that extended Detroit's lead to 27-17 on the first play of the fourth quarter.
The Eagles' injury-depleted offense missing its top two receivers was sloppy.
"Can't make excuses," Agholor said. "We had opportunities. We have to make plays."
The Eagles cut it to 27-24 when Wentz threw a 2-yard TD pass to Agholor with 6:59 left. Penalties cost the Lions on that drive. A late hit on Wentz against Trey Flowers extended it and an unnecessary roughness call on Jarrad Davis moved the ball to the 5.
Wentz threw a 20-yard TD pass to Agholor in the third quarter. But the Lions answered with Stafford's TD to Jones.
Kerryon Johnson's 1-yard TD run gave the Lions a 14-10 lead early in the second quarter.
Sanders fumbled twice on one drive and Detroit recovered his second one. That led to Prater's 25-yard field goal and a 17-10 lead.
Jordan Howard ran in from the 1 after Wentz scrambled 19 yards on third-and-6, giving the Eagles a 10-7 lead in the first quarter.
Agnew had the first kickoff return for a score this season. There were five in the NFL last year.
Patricia was on the other sideline as New England's defensive coordinator when Nick Foles led the Eagles to a 41-33 win over the Patriots in the Super Bowl two seasons ago.
Stafford now is 2-1 against Jim Schwartz, the Eagles defensive coordinator who was a first-year head coach when Detroit drafted the quarterback No. 1 overall in 2009.
Sanders had his helmet ripped off on a kickoff return when he was clotheslined by Miles Killebrew, who also grabbed the facemask and spun it around. There was no penalty called. The blatant miss was nearly as obvious as the non-call on the pass interference in the Rams-Saints NFC championship game. Todd Prukop was the back judge for both games.
The Eagles scored 10 points in the first quarter after scoring only 20 points combined in the previous 12 first quarters.
Lions: DT Mike Daniels (foot) left in the first quarter and didn't return and Slay (hamstring) exited in the third quarter.
Lions: Host Kansas City next Sunday. The Chiefs won the previous matchup 45-10 on Nov. 1, 2015, but the Lions have won the past two times at home.
Eagles: At Green Bay on Thursday night. The Packers have won five of the past six meetings, including a 53-20 rout at Lambeau Field on Nov. 16, 2014.
More AP NFL: https://apnews.com/NFL and https://twitter.com/AP-NFL
Lions agree to deal with ex-Packers WR Geronimo Allison
The Detroit Lions have agreed to a contract with wide receiver Geronimo Allison, the team announced Sunday.
NFL free agency: Ranking the 15 best remaining free agents
After a wild few days of NFL free agency, we rank the best available players still on the market, starting with a playmaker off the edge in Jadeveon Clowney.
Chiefs have ability to bring back all 4 WRs
Adam Teicher says the Chiefs are in a good position with their wide receivers if they retain Sammy Watkins and can focus on using their draft picks to address other needs, namely at cornerback.
2020 free agency: NFL experts debate most improved teams, best signings, more
Most improved team? Team still looking for answers? Best move we've seen, and the top bargain? Our team breaks down free agency.
Tom Brady is the signing of a lifetime for long-suffering Bucs fans
For a franchise that has long struggled to attract big names, adding arguably the greatest QB of all time still feels like a dream.
Stephon Gilmore takes the Patriots' offseason changes in stride
New England's top defender says Tom Brady's departure is just the latest reminder the NFL is "a business, and that's how you have to look at it."