It wasn’t easy for the Dolphins, but they rallied for a 31-27 win over Detroit. The Dolphins improved to 5-3, while the Lions fell to 1-6.

Miami twice trailed by 14 points in the first half, and it was behind 27-17 at halftime. But Detroit, which scored on all five possessions of the first half, came up empty in the second half.

The Lions twice punted in the second half and turned the ball over on downs on their last possession of the game. Detroit reached the Miami 35 and faced a fourth-and-one, but Jared Goff overthrew Josh Reynolds by a step in the end zone.

The Dolphins gained 476 yards, as Tua Tagovailoa completed 29 of 36 passes for 382 yards and three touchdowns. Tyreek Hill caught 12 passes for 188 yards, and Jaylen Waddle made eight receptions for 102 yards and two touchdowns.

Goff finished 27-of-37 for 321 yards and a touchdown. The Lions had not scored a touchdown since Oct. 2, but they had no problem doing that in the first half with three of them.

The Lions totaled 393 yards, but they had 326 at halftime.

Jamaal Williams rushed for two scores, getting 53 yards on 10 carries.