EAST RUTHERFORD, N.J. (AP) -- Sam Darnold returned - and so did the New York Jets' hopes to turn around a season that was quickly unraveling without him.
Darnold gave the Jets' struggling offense a huge boost by throwing two touchdown passes in his return from mononucleosis, and New York held on to beat the Dallas Cowboys 24-22 on Sunday night for their first win of the season.
''I'm just really, really excited for the guys in this locker room,'' Darnold said. ''We were starving for a win.''
The Jets led 21-9 in the fourth quarter, but Dak Prescott and the top-ranked Cowboys offense stormed back - and had a chance to tie in the wild closing moments.
With Dallas marching down the field, officials called six straight penalties during one stretch including four on the Jets putting the Cowboys in scoring position.
Prescott ran for a 4-yard touchdown with 43 seconds left, making it a two-point game. Going for the tie, Prescott dropped back and was quickly met by a blitzing Jamal Adams and his pass on the conversion try fell short of Jason Witten in the end zone.
The Cowboys (3-3) tried an onside kick, but Demaryius Thomas recovered for the Jets (1-4), who won for the first time under coach Adam Gase. It was the third straight loss for Dallas.
''To come out here and do it in the fashion we did and the defense getting a huge stop on the 2-point conversion,'' Darnold said, ''I wouldn't want it any other way.''
Darnold, who missed three games while recovering from mononucleosis, finished 23 of 32 for 338 yards - including a 92-yard touchdown toss to Robby Anderson and a 5-yarder to Ryan Griffin. Darnold was intercepted by Jourdan Lewis late in the third quarter after throwing 179 consecutive passes without being picked off, dating to Week 14 of last season at Buffalo.
Le'Veon Bell also ran for a score, his first on the ground with the Jets.
The Cowboys played without starting tackles La'el Collins and Tyron Smith, and star wide receiver Amari Cooper was sidelined most of the game with a quadriceps injury. But Dallas made it a five-point game on Ezekiel Elliott's 5-yard run with 6:30 remaining, capping an 11-play, 84-yard drive.
Sam Ficken's 38-yard field goal with 3:24 left made it 24-16, but the Cowboys had one more long drive in them.
And, the Jets' defense had one final stop in them.
''No one counted us to win that game,'' linebacker Jordan Jenkins said. ''Everyone bet on the Cowboys. They thought we were going to come in and get blown out.''
Prescott was 28 of 40 for 277 yards. Elliott finished with 105 yards and a touchdown on 28 carries.
''We're putting ourselves behind,'' Prescott said. ''We're putting our defense in a tough spot. We're not playing complementary football. It's simple as that. We've got to start faster. We've got to get points. We've got to get touchdowns and allow our defense to play from up.
''As long we have these slow starts, we're going to struggle.''
Darnold came out throwing in his first snap since the season opener and connected with Thomas for a 17-yard gain. But, Robert Quinn sacked him on the next play and the drive stalled - making it 29 straight games the Jets have failed to score a touchdown on their opening possession, the longest active streak in the NFL.
But, Darnold and the Jets got on the scoreboard on their second drive, capped Bell's 2-yard touchdown run.
Darnold was efficient on the 14-play, 83-yard drive, going 6 of 8 for 43 yards. New York was also helped by three penalties on Dallas, including a horse-collar tackle of Darnold by Maliek Collins on third-and-goal from the 7 that gave the Jets the ball at the 2.
''I definitely felt like myself out there,'' Darnold said. ''Especially after the first play to D.T., that pass I made to D.T., I knew we were going to have a good game offensively.''
New York finished with 382 yards after getting 233 combined in the last two games with Luke Falk at quarterback.
''It's unacceptable for us to give up that many points,'' Cowboys linebacker Jaylon Smith said. ''That's not an elite defense.''
Trailing 7-3, Prescott and the Cowboys marched down the field and got to the Jets 6, but stalled. Elliott lost a yard on third down and Jason Garrett opted to go for it on four-and-2 from the 7. Prescott took the ball on a keeper, but was stuffed by rookie Quinnen Williams for a loss of a yard - and a turnover on downs.
Darnold came out on the very next play and found a wide-open Anderson zipping down the field and hit him in stride for a 92-yard touchdown to put the Jets up 14-3 with 3:34 left in the opening half. It was the second-longest reception in franchise history behind the 96-yard TD catch by Wesley Walker on a pass from Ken O'Brien at Buffalo on Dec. 8, 1985.
Brett Maher kicked three field goals for the Cowboys, including tying his franchise record with a 62-yarder as the first half ended to make it 21-6.
It was also the longest field goal ever made against the Jets. Maher also made a 62-yarder against the Eagles last December, making him the first kicker in NFL history, according to Sportradar, with two field goals of at least 62 yards.
Denver's Matt Prater holds the NFL record for longest field goal, kicking a 64-yarder in 2013.
Maher, who also had field goals of 50 and 32 yards, later missed a 40-yarder that sailed wide right 51 seconds into the fourth quarter.
Cowboys: CB Byron Jones left in the second half with a hamstring injury. ... DE Dorance Armstrong left in the second quarter to be checked for a neck injury. ... CB Anthony Brown left in the second half with a hamstring injury.
Jets: LT Kelvin Beachum hurt an ankle in the third quarter and didn't return. .... LB Neville Hewitt, the team's leading tackler, left midway through the second quarter with an undisclosed injury but returned late in the third quarter. ... NT Steve McLendon suffered a concussion in the third quarter. ... LB Albert McClellan left in the third quarter to be evaluated for a concussion.
Cowboys: home vs. NFC East rival Philadelphia Eagles next Sunday night.
Jets: host undefeated AFC East rival New England Patriots next Monday night.
More AP NFL: https://apnews.com/NFL and https://twitter.com/AP-NFL