SANTA CLARA, Calif. — The difference between the San Francisco 49ers and Baltimore Ravens basically came down to a couple of fourth-down conversions.

After the 49ers failed to convert on a fourth-and-short chance midway through the fourth quarter, the Ravens capitalized on one of their own to set up the winning field goal in a 20-17 victory Sunday between two of the NFL's top teams.

"I thought we had our opportunities there at the end," coach Kyle Shanahan said Monday. "Big miss not being able to convert that fourth-and-1. I think we would've had a good chance to win the game if we did that. ... A hard-fought game and two good teams that I think both played well, and we ended up not being able to get the win."

The key stretch came in the fourth quarter when Jimmy Garoppolo had a pass batted down at the line of scrimmage on fourth-and-1 from the Baltimore 33 with 6:35 to go.

The Ravens then ran out the rest of the clock, converting a fourth-and-1 run by Lamar Jackson along the way, and won on Justin Tucker's 49-yard field goal.

"It was a great game," 49ers tight end George Kittle said. "I think two of the best teams in the NFL went at it, and they made a couple more plays than we did. It's tough."

WHAT'S WORKING

Running game. After a somewhat sluggish performance the past few weeks, the running game shined on a rainy day thanks to backup Raheem Mostert. Mostert used his speed to get to the edge repeatedly and finished with 146 yards on 19 carries for the biggest rushing day since Shanahan took over as coach in 2017. Mostert joined Tevin Coleman and Matt Breida as San Francisco backs to post 100-yard games this season, marking the second time since the merger that San Francisco had three 100-yard rushers in a season. Frank Gore, Kevan Barlow and Maurice Hicks all did it in 2005.

WHAT NEEDS HELP

Handling QB runs. The Niners too often tried to take out the back in the read-option game, allowing Jackson to get outside for big gains. Jackson had 16 carries for 101 yards, joining Aaron Brooks as the only quarterbacks to run for at least 100 yards against San Francisco since the merger.

STOCK UP

RT Mike McGlinchey. A knee injury early in the season limited McGlinchey’s effectiveness in his second season. But he is coming back to form now. He played well last week against the Packers and possibly had his best game yet against the Ravens. Many of Mostert’s big runs came behind McGlinchey, and he wasn’t beaten at all in pass blocking either.

“I thought Mike had his best game of the year versus Green Bay and then I think he followed that up with his new best game of the year yesterday,” Shanahan said. “I know Mike's been battling through some injuries to get back. I know when he did get back, it still takes some time to get back to your old self, but I saw that last week definitely, and I think he only got better this week."

STOCK DOWN

Shanahan. The Niners took too much time on a drive at the end of the first half and ended up having to settle for a 51-yard field goal attempt by Robbie Gould that was partially blocked. Then on the fourth down in the fourth quarter, Shanahan opted to go to the shotgun formation, which eliminated the threat of a QB sneak. Garoppolo's pass never made it to his target and the Niners never got the ball again.

INJURED

CB Richard Sherman (knee), S Jaquiski Tartt (ribs) and DT D.J. Jones (ankle) are all day to day. DL Jullian Taylor will likely miss a couple of weeks with a ligament injury in his elbow. LT Joe Staley (finger), DL Dee Ford (quadriceps, hamstring) and RB Matt Breida (ankle) all could return from injuries this week.

KEY NUMBER

28 — The Ravens turned a fumble by Garoppolo into a first-quarter touchdown. San Francisco has allowed 28 points off turnovers in its two losses, including three TDs against Seattle last month. The 49ers have allowed just 19 points — and only one TD — off turnovers in their 10 wins.

NEXT STEPS

The 49ers will spend the week in Florida before taking on another first-place team next Sunday in New Orleans against the Saints.

___

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