MIAMI GARDENS, Fla. — Jason Sanders kicked a go-ahead 50-yard field goal with 18 seconds left, helping the Miami Dolphins to their first playoff berth since 2016 after squeaking by the New York Jets 11-6 on Sunday.

Playing without injured starting quarterback Tua Tagovailoa, the Dolphins (9-8) snapped a five-game losing streak and then had to wait a few minutes for Buffalo to defeat New England 35-23 to make their postseason appearance official. “We're In” was displayed on the videoboard at Hard Rock Stadium.

Miami will play at Buffalo in the first round of the playoffs next weekend. The AFC East rivals split the season series with each winning at home.

Sanders' kick came after the Dolphins were helped by a 15-yard horse-collar tackle penalty on Quincy Williams.

The Jets (7-10) ended the season with six straight losses, finishing a disappointing collapse for Robert Saleh's squad. New York failed to score a touchdown in its final three games.

On the Jets' last-ditch effort with time running out, they lateraled the ball a few times before Elijah Moore fumbled, the ball was recovered by Garrett Wilson and he was ruled to be tackled in the end zone for a safety.

The Jets reached midfield with 7:28 left on a 27-yard penalty after a defensive pass interference call on Dolphins cornerback Kader Kohou. That drive ended in a punt by an offense that had fewer than 200 total yards.

The Jets had tied it with about 12 minutes left on a 35-yard field goal by Greg Zuerlein. Joe Flacco led the team down the field on a 14-play, 75-yard drive.

Flacco completed 17 of 32 passes with 169 yards for the Jets in the place of Mike White, who is dealing with broken ribs.

In their most important game of the season, the Dolphins’ offense was limited with veteran left tackle Terron Armstead inactive and rookie Skylar Thompson at quarterback.

Thompson had a full week of first-team practice reps after replacing the injured Teddy Bridgewater in last Sunday’s loss at New England. He completed 20 of 31 passes for 152 yards.

Miami punted on two of its first four drives. The other two ended in a turnover on downs and a 37-yarder by Sanders.

Miami got close to the end zone midway through the third quarter, set up by tough runs of 14, 11 and 21 yards by Raheem Mostert. The Dolphins lost 11 yards on first down at the Jets 13, however, Thompson couldn’t connect with Tyreek Hill in the end zone on third-and 16, and the Dolphins settled for a field goal.

Hill was limited by an ankle injury sustained in the first half, but he only briefly left the game. He caught two passes on five targets for 23 yards, his fewest in a game this season.

Mostert and Jeff Wilson combined for 143 yards rushing for the Dolphins.

Tight end Mike Gesicki led the Dolphins with 46 yards, including a 32-yard catch in the fourth quarter.

The status of Tagovailoa, the Saint Louis School product who is recovering from his second diagnosed concussion of the season, is unclear for the Dolphins' playoff game.