SANTA CLARA, Calif. — Eli Manning showed he still has what it takes to lead the kind of game-winning drive that earned him two Super Bowl MVP awards.

Manning capped a 75-yard drive with a 3-yard touchdown pass to Sterling Shepard with 53 seconds left and the New York Giants snapped a five-game losing streak by beating the San Francisco 49ers 27-23 on Monday night.

"It doesn't get old," said Manning, whose 36 game-winning drives are the third most in the NFL since he entered the league in 2004. "It's fun. It's fun playing in those games and having a two-minute drive to win it. Those are the situations you want to be in. You want to have a chance."

The Giants (2-7) have failed to capitalize on those late-game situations this season, losing five games by seven or fewer points as part of a disappointing stretch that has put the 37-year-old Manning's status as starting quarterback in question.

But Manning delivered against the 49ers (2-8) to give New York a much-needed win.

"That's what Eli is really good at, engineering those come-from-behind drives," coach Pat Shurmur said. "That was terrific. He hung in there and made some really good throws and got us into the end zone. That's the sign of a good quarterback."

Manning threw two TD passes to Odell Beckham Jr. and then engineered the late game-winning drive with help from a pair of third-down penalties against Malcolm Smith and Ahkello Witherspoon.

Saquon Barkley then had a 23-yard catch to get the ball into the red zone and Manning connected with Shepard on third down to give the Giants the win.

"I just saw man-to-man coverage," Shepard said. "That's something we've been practicing. I was able to capture the outside edge and Eli put the ball in a perfect place."

Matt Breida ran for 101 yards and scored two touchdowns for the 49ers (2-8), who were unable to win consecutive games under third-string quarterback Nick Mullens. Breida's 23-yard run helped set up a 30-yard field goal by Robbie Gould that gave the Niners a 23-20 lead with 2:46 to play.

But the 49ers allowed the go-ahead score and couldn't pull it out at the end as Mullens' pass from the Giants 21 sailed out of the end zone on the final play.

"Those are the plays you have to make to finish the game," Mullens said. "That was a moment of truth, and I didn't get the job done. I have to play better in those moments of truth. We all have to play better."

Mullens wasn't nearly as sharp as he was in his NFL debut against the Raiders on Nov. 1 when he joined Hall of Famers Jim Kelly and Fran Tarkenton as the only players with at least 250 yards passing, three touchdown passes and no interceptions in the first career game.

Mullens threw for 250 yards and had an 11-yard TD pass to Breida that made it 20-10 early in the third quarter. But Mullens also threw two interceptions with the first setting up a 10-yard TD pass from Manning to Beckham .

Those two connected again on a 20-yard score in the third quarter as New York rallied from 10 points down to tie the game in the second half.

HARD HIT

Niners receiver Marquise Goodwin was hit in the helmet by Alec Ogletree on a catch late in the third quarter and briefly left the game. On his first play back in to start the fourth quarter, a pass from Mullens deflected off Goodwin's hands for the second interception of the game by B.J. Goodson . Goodwin was slow to get up after that play and went back into the medical tent for observation. Goodwin returned to the game later in the fourth quarter.

BAD REACTION

Witherspoon got beat on Beckham's second TD catch and immediately threw his hands up in disgust because he didn't get the safety help he expected from Antone Exum. Teammate Richard Sherman and coaches talked to Witherspoon on the sideline to tell him not to show up a teammate.

"Man up. Don't put that on tape," coach Kyle Shanahan said. "We'll deal with that when we come in."

CENTURY MARK

Barkley rans for 67 yards and added 33 receiving to join Eric Dickerson as the only players since the merger to gain at least 100 yards from scrimmage in eight of their first nine career games.

MISSED OPPORTUNITY

The Giants entered the game converting just 40 per cent of their red zone trips into TDs. They missed a golden opportunity for one late in the first half. On a third down from the 3, the 49ers left Beckham unguarded in the slot but Manning stuck with a run play to Barkley that gained only 1 yard. New York settled for a field goal that tied the game at 10.

PLAYING FOR PARADISE

Niners GM John Lynch welcomed the high school football team from Paradise, a town destroyed by the wildfires in Butte County, about 175 miles north. Players and cheerleaders from the school were on the field for the national anthem. The Niners raised more than $100,000 to support relief and recovery efforts.

The air quality for the game was at an unhealthy level because of the fires. The Air Quality Index was at 161 at kickoff, which is in the unhealthy zone, and smoke could be smelled throughout the stadium. The NFL had monitored the situation but the AQI never got near 200, the level where the game would have needed to be moved.

UP NEXT

Giants: Host Tampa Bay on Sunday.

49ers: Visit Tampa Bay on Nov. 25.

___

More AP NFL: https://apnews.com/NFL and https://twitter.com/AP_NFL