EAST RUTHERFORD, N.J. — The Los Angeles Chargers finally grabbed a win, while the New York Giants just about lost everything.

Philip Rivers threw a 10-yard touchdown pass to Melvin Gordon with 2:58 to play and the Chargers rallied for a 27-22 victory Sunday in an ugly game between teams that each went 0-4 in the first month of the season. To make matters worse for the Giants, dynamic wide receiver Odell Beckham Jr. departed because of a broken left ankle.

Beckham was injured on the series before the winning touchdown. He jumped to catch a high Eli Manning pass and had Los Angeles cornerback Casey Hayward pin his ankle making a tackle. Players immediately signaled the sideline, and Beckham was eventually carted off in obvious pain with a hand covering his face.

The Giants also had three other receivers injured.

Rivers’ third touchdown pass of the game came three plays after Kyle Emanuel had a sack, forced fumble and recovery against Manning at the Giants 11.

“We found a way,” said Chargers Coach Anthony Lynn after his first win. “We’ve been looking for a way to win close games and we found a way. Now we’re going to enjoy this one, and tomorrow we’ll work on what that lesson really was.”

Rivers also hit Gordon for a 6-yard TD pass in the second quarter and Hunter Henry for a 25-yarder in the third quarter.