SAN DIEGO (AP) -- Kiko Alonso intercepted Philip Rivers' pass and returned it 60 yards for a touchdown with 1:01 left to give Miami a wild 31-24 victory over the San Diego Chargers on Sunday, the Dolphins' fourth straight.

The Dolphins (5-4) intercepted Rivers four times, all in the fourth quarter.

Alonso jumped in front of Tyrell Williams and outraced everybody into the end zone for the winning score.

More from FoxSports

Two plays into the ensuing drive, Rivers was intercepted again, by Tony Llippett, his second of the game.

Rivers threw three touchdown passes to move past John Elway for eighth place on the career list with 301.

Rivers' 51-yard touchdown pass to Williams with 4:04 left gave the Chargers (4-6) a 24-21 lead.

Miami came right back to get a 27-yard field goal from Andrew Franks to tie it. That was set up by Ryan Tannehill's 56-yard pass to DeVante Parker and a roughing-the-passer call that put the ball on the San Diego 10.

Damien Williams scored on a 2-yard run and on an 18-yard pass from Tannehill for the Dolphins.

Jay Ajayi ran for 79 yards, ending his streak of three straight 100-yard games, but he had big runs to set up two touchdowns by Damien Williams.

Williams scored on a 2-yard run on the opening drive of the second half to give Miami a 14-10 lead. Ajayi had a 40-yard run on the drive.

San Diego regained the lead at 17-14 on Rivers' 7-yard pass to rookie Hunter Henry in the right corner of the end zone.

The Dolphins came right back and took a 21-17 lead when Tannehill threw an 18-yard pass to Williams. That drive was kept alive by Ajayi's 21-yard run and Tannehill's 18-yard scramble.

The Chargers blew a great opportunity to jump back into the lead after Jakeem Grant muffed a punt and Darrell Stuckey recovered it at the Miami 5. The Chargers had five chances from the 5 or closer -- thanks a holding call against Byron Maxwell -- and ended up with Rivers being intercepted by Lippett in the end zone after forcing a pass into double coverage.

After Miami went three-and-out, Rivers gave it right back when he was intercepted by Byron Maxwell with 6:49 to go. The Dolphins failed to capitalize.

Rivers threw an 11-yard touchdown pass to Antonio Gates for a 10-0 lead. It was the 82nd time those two connected, extending their NFL record for a quarterback-tight end duo.

Gates needs two TD catches to tie Tony Gonzalez's NFL record for touchdown grabs by a tight end (111).

Tannehill threw a 39-yard touchdown pass to Kenny Stills in the first half.

WEST COAST WEEK

Since the Dolphins are playing at the Los Angeles Rams next Sunday, they're staying in northern San Diego County this week. That gave Stills a chance to show some teammates where he went to high school and make a special visit. "I got to see my dog for the first time in like a year and a half," said Stills, who stayed in Miami last offseason to work out.

INJURIES

Chargers CB Brandon Flowers left late in the third quarter and was being evaluated for a concussion. ... Dolphins DE Mario Williams left with an ankle injury.