Rookie quarterback Tua Tagovailoa ran for a pair of fourth-quarter touchdowns as the host Miami Dolphins defeated the New England Patriots 22-12 on Sunday.

Tagovailoa passed for 145 yards with one interception, keeping Miami (9-5) on track for its first playoff berth since 2016. The Dolphins are guaranteed to make the playoffs with wins in their final two regular-season games.

New England (6-8) was led by Nick Folk, who made four field goals. Quarterback Cam Newton passed for 209 yards.

However, the Patriots had their streak of 19 consecutive winning seasons snapped and will miss the playoffs for the first time since 2008.

In addition, the Patriots lost cornerback Stephon Gilmore — the NFL’s reigning Defensive Player of the Year — to a knee injury in the second quarter. He did not return.

New England also lost starting linebacker Ja’Whaun Bentley (arm injury).

Miami played without four of its top offensive playmakers: wide receiver DeVante Parker (hamstring), tight end Mike Gesicki (shoulder), running back Myles Gaskin (COVID protocol) and kick returner Jakeem Grant (hamstring). Starting guard Ereck Flowers (ankle) was also out, and his backup Solomon Kindley (leg) left in the third quarter.

There were no scores in the first quarter, but Miami had a 95-yard drive that ended with J.C. Jackson’s eighth interception of the season. That pick, on third-and-goal from the 3, ended a drive that took 9:11 off the clock.

Folk made two field goals in the second quarter, from 45 and 36 yards, giving the Patriots a 6-0 halftime lead.

The Dolphins nearly had a big play with 4:36 left in the second. Newton scrambled toward the right sideline and was tackled by rookie safety Brandon Jones, who helped force a fumble. Cornerback Xavien Howard stayed in bounds and ran 86 yards for an apparent touchdown.

However, the play was nullified on video review because the ball touched Dolphins defensive lineman Christian Wilkins while he had one foot out of bounds.

Miami’s forgettable first half finished with Jason Sanders missing a 52-yard field goal wide left.

The Dolphins finally got on the board with 10:32 left in the third quarter, taking a 7-6 lead on Salvon Ahmed’s 1-yard run and Sanders’ extra point.

New England headed to the fourth quarter with a 9-7 lead thanks to another 45-yarder by Folk.

However, the Patriots failed to get into the end zone for the second straight game, and they could not rally.

Tagovailoa scored a 3-yard, go-ahead TD with 12:55 left before Folk kicked a 42-yard field goal with 9:07 left to cut the Miami lead to 15-12. Tagovailoa put the game away with a 1-yard quarterback sneak with 3:17 remaining.