ORCHARD PARK, N.Y. (AP) -- Sam Darnold had difficulty containing his excitement after the New York Jets rookie enjoyed his first fourth-quarter comeback victory in the NFL.
On the other side of the tunnel, Buffalo rookie Josh Allen had difficulty keeping his frustrations in check after his three turnovers contributed to costing the Bills.
Darnold, drafted third overall, one-upped Allen in their first meeting as AFC East rivals by rallying the Jets to a 27-23 win Sunday.
''As a kid, you dream of converting two-minute drives and going down there and scoring,'' Darnold said. ''To be able to score a touchdown and put the ball in their hands at the end of the game was awesome.''
Allen, drafted seventh overall, was left dejected in a game he outran, out-passed and ultimately out-turnovered Darnold.
''I've got to be smarter with the football,'' said Allen, who threw two interceptions and lost a fumble. His fumble and first interception led to the Jets kicking two field goals.
His second interception sealed the loss with 59 seconds left, when he was picked off by Trumaine Johnson at Buffalo's 45.
Running back Elijah McGuire scored on a fourth-and-goal run from the 1 with 1:17 remaining to cap a drive during which Darnold completed three of five passes for 52 yards. The rookie quarterback particularly showed off his deft touch on a 37-yard pass to Robby Anderson, who made an over-the-shoulder catch up the right sideline.
Darnold finished 16 of 24 for 170 yards with a 7-yard touchdown to Anderson and an interception in his first start since missing three with a strained right foot. Aside from shaking off the rust, Darnold also overcame a scare in the first quarter when he left for one series after hurting the same foot.
Darnold was cleared to return after having the injury examined.
The Jets (4-9) snapped a six-game losing streak, and bounced back a week after squandering a 16-0 lead in a 26-22 loss at Tennessee.
The Jets won when embattled coach Todd Bowles elected to gamble after Darnold was stopped at the 1 on third-and-goal from the 4.
McGuire scored by taking a handoff and running to his right before finding a crease to squeeze his way into the end zone. He finished with 60 yards and was playing in place of starter Isaiah Crowell, who left with a shoulder injury in the second quarter.
''No decision whatsoever. We came up here to win the game,'' Bowles said on deciding to go for the touchdown. ''I'm just happy for them. ... To see them smile makes me smile.''
Buffalo dropped to 4-9.
Allen went 18 of 36 for 206 yards and scored on a 6-yard run. He also had 101 yards rushing to become just the second quarterback in NFL history to top 90 yards in three consecutive games, joining Tobin Rote, who did that with Green Bay in 1951.
Allen didn't care much for the feat, and wasn't in the mood to discuss the matchup with Darnold. The two became friends while spending the pre-draft process working out with each other.
''I mean, it was cool,'' Allen said. ''But, I'm playing against their defense, and we just didn't make as many plays as we needed to.''
Buffalo squandered a 14-3 lead, and was undone by a special teams unit that allowed Andre Roberts to return five kickoffs for 176 yards. Roberts' 86-yard return set up Trenton Cannon's 4-yard run, which cut Buffalo's lead to 17-13 with 6:31 left in the second quarter.
It was the first touchdown scored by the Jets' offense in 24 possessions, dating to the first quarter of a 27-13 loss to New England two weeks ago.
The Jets' special teams also blocked Stephen Hauschka's 49-yard field-goal attempt at the end of the first half.
New York trailed until Darnold capped an 11-play, 85-yard drive by hitting Anderson for a 7-yard touchdown pass to tie the game at 20 with 12:06 left.
The Bills responded with Hauschka hitting a 36-yard field goal with 2:31 remaining.
Allen scored on a 7-yard run and Isaiah McKenzie also scored on a 15-yard run.
BANGED UP BILLS
Buffalo was down to third-string running back Marcus Murphy after LeSean McCoy was sidelined by a hamstring injury in the first quarter and Chris Ivory hurt his ankle in the third quarter. Starting linebacker Matt Milano was carted off the field after getting his leg tangled while stopping Darnold at the goal line. Coach Sean McDermott provided no updates on his injured players.
Bills undrafted rookie Robert Foster had 104 yards receiving in his first career start after the Bills released Kelvin Benjamin on Tuesday. Foster now has two 100-yard outings, both of them coming against the Jets. He had 105 yards receiving in a 41-10 win at the Meadowlands on Nov. 11.
Jets linebacker Darron Lee served the first game of a four-game NFL suspension for violating the league's substance abuse policy. ''A great disappointment,'' Bowles said. ''He made a big mistake and only time will tell whether he will learn from it or not.''
Jets: Host Houston on Saturday.
Bills: Close their non-conference schedule by hosting Detroit on Dec. 16.
More AP NFL: https://apnews.com/NFL and https://twitter.com/AP-NFL