The New York Giants ended a five-game losing streak as they edged out the San Francisco 49ers 27-23 in dramatic fashion.

With the Giants trailing 23-20 in the closing stages, Eli Manning threw a three-yard touchdown pass to Sterling Shepard with 53 seconds left to clinch the victory.

It was Manning’s 36th game-winning drive of his career, and he finished the contest with 19-of-31 for 188 yards with three touchdowns – two to star receiver Odell Beckham Jr.

A last-second drive by 49ers quarterback Nick Mullens was ultimately unsuccessful as the final play fell incomplete.

The Giants improved their record for the season to 2-7, while the 49ers remain bottom of the NFC West on 2-8.