DETROIT (AP) -- The Detroit Lions were waiting for the right time and team to try a trick play they've worked on in practice recently.
Early in the fourth quarter Sunday, the New York Giants proved to be the perfect opponent.
Matthew Stafford threw a 41-yard flea flicker to Kenny Golladay to restore a double-digit lead Detroit needed to help them hold on for a 31-26 win over the slumping Giants.
"That was a good one," Stafford said. "A great call."
Detroit's first-year offensive coordinator, Darrell Bevell, called for Stafford to pitch the ball to J.D. McKissic to the right and for the running back to throw a lateral back to the quarterback to connect downfield with Golladay.
"I was holding my breath on that one," Lions coach Matt Patricia acknowledged.
Bevell used the same play with McKissic taking the pitch from Seattle quarterback Russell Wilson for a 38-yard touchdown Paul Richardson in a win over the Giants two years ago.
The Lions (3-3-1) enjoyed the feel-good moment as part of a much-needed win after losing three straight games and trading away safety and captain Quandre Diggs to Seattle days before the game.
Stafford finished 25 of 32 for 342 yards with three touchdowns and an interception. He threw a 49-yard TD pass to Marvin Hall late in the first quarter and connected with Golladay for two scores in the second half.
In the last three home games, Stafford has thrown 10 TDs with just two interceptions and is averaging 332 yards passing.
"There's a bunch of great players around me," he said, refusing to take credit.
New York (2-6) had chances to come back, but they turned the ball over on downs at the Lions 39 with 6:25 and at their 14 with 3:27 left.
Giants rookie Daniel Jones threw a 4-yard TD pass to Saquan Barkley and an extra point pulled them within five points with 1:19 left to play. The ensuing onside kick went out of bounds, sealing Detroit's victory.
"They always battle, but we've got to play better and make more plays," said second-year coach Pat Shurmur, who fell to 7-17 with the franchise.
The Giants have lost four games in a row before the end of October for the second straight season and they're planning to have a players-only meeting Monday.
"Sometimes it's better to hear it from the players and individuals in the locker room," Barkley said. "Sometimes you just got to address situations."
Jones had career highs with 28 completions, 41 attempts, four TD passes and fell just short of another mark with 322 yards passing. He fumbled the ball while being hit attempting a pass and former Giants linebacker Devon Kennard recovered the football and returned 13 yards for a TD in the first quarter.
Jones provided a promising performance after throwing only TD pass in each of his last four games and seven interceptions during that span. He threw 22- and 28-yard TD passes to rookie receiver Darius Slayton, who pulled the Giants within a point late in the first half only to have Aldrick Rosas miss his first extra point of the season.
"We've known we can move the ball on people," Jones said. "We've known we can score points. We haven't done enough of it."
BY THE NUMBERS
Giant: Barkley had 64 yards rushing on 19 carries and 79 yards receiving on eight catches. Former Lions WR Golden Tate had eight receptions for 85 yards.
Lions: Golladay had 123 yards receiving and two scores on six catches. Danny Amendola caught eight passes for 95 yards. RB Tra Carson had a career-high 34 yards on 12 carries, starting in place of Kerryon Johnson, who is on injured reserve with a knee injury.
Giants: WR Sterling Shepard (concussion) was out for the third straight game.
Lions: CB Darius Slay (hamstring) was inactive and CB Rashaan Melvin (knee) limped off the field late in the third quarter and didn't return. Former Giants DT Damon "Snacks" Harrison was limited by a groin injury.
Giants: Host Dallas on Monday, Nov. 4.
Lions: Play at Oakland on Sunday.