The San Francisco 49ers managed to hold on to beat the Detroit Lions 30-27 in Week 2, stopping a fourth-quarter surge by quarterback Matthew Stafford and Co. Overall, let's take a position-by-position look from the Niners' perspective.


Well, the San Francisco 49ers could have easily been 0-2 on the young season. And while their 30-27 win over the Detroit Lions got the Niners back to the .500 mark in 2018, the Lions' fourth-quarter surge easily could have resulted in a second consecutive loss for head coach Kyle Shanahan and Co.

All one needs to do is look at quarterback Jimmy Garoppolo's fourth-quarter would-be interception that was negated by a Detroit penalty.

Support this writer and shop Amazon

San Francisco hung on to win in Week 2. And the Niners could have won their Week 1 bout versus the Minnesota Vikings had they played a bit crisper.

Let's start with Garoppolo, breaking down what went well and what didn't as we look at full positional grades for the 49ers' Week 2 efforts.

Quarterback


Garoppolo was 18-of-26 for 206 yards and two touchdowns for a passer rating of 118.4. But the numbers are deceiving, as Garoppolo's near pick in the fourth quarter could have spelled disaster for San Francisco. And at least three of the six sacks Garoppolo took were the direct result of Jimmy G holding onto the ball far too long within the pocket.

Grade: C

Running Back


If running back Matt Breida didn't have his 66-yard touchdown scamper in the third quarter, the Niners don't win Week 2:


Breida took advantage of a suspect Lions run defense, ripping off 138 yards on 11 carries with the touchdown.

Grade: A

Wide Receiver/Tight End


Garoppolo's favorite target is tight end George Kittle, and he drew a number of penalties Sunday. Those help. But with wide receiver Marquise Goodwin out, rookie Dante Pettis would have to step up and assume a No. 1 role. He had one catch, though, to veteran Pierre Garçon's four.

Backup boundary receiver Kendrick Bourne recorded his first NFL touchdown -- a four-yard grab that put the Niners up 13-10 in the second quarter. That was his only catch of the game, but it counted. It would have been nicer, however, if the rest of the 49ers receivers were able to create separation, making life easier for Garoppolo.

Fellow tight end Garrett Celek hauled in San Francisco's third touchdown of the game.

Grade: B-

Offensive Line


Those six sacks Garoppolo took won't make the offensive line look good. But at least three of those were on Garoppolo. After the game, head coach Kyle Shanahan also pointed out how Garoppolo and the receivers could do a better job of getting open and moving the ball.

That would help the O-line, which did a much better job run blocking than it did a week ago.

Grade: B-

Defensive Line


Defensive tackle DeForest Buckner is good. And his one sack Sunday helped eclipse the three total sacks he had for the entirety of 2017 (Buckner entered Week 2 with 2.5 sacks recorded in Minnesota).

The Niners had some success with four-man pressure on the day, although it was interesting to see EDGE Cassius Marsh rotated in for defensive end Solomon Thomas, who was coming out the majority of passing plays. That's unfortunate, as Thomas' ceiling as the No. 3 overall pick from last year's NFL Draft isn't close to being reached.

Grade: B

Linebacker


The 49ers sorely miss linebacker Reuben Foster, who wrapped up the second of his two-game suspension on Sunday. And with fellow linebacker Malcolm Smith (hamstring) out, the Niners were forced to start Elijah Lee alongside the rookie, Fred Warner.

Lee might have led all San Francisco defenders with 12 tackles and had a sack in the process. But he also missed at least four on the afternoon, many of which went for big Detroit gains.

Those issues won't be a problem once Foster returns.

Grade: D+

Secondary


It's not hard to have seen this coming, but cornerback Richard Sherman's presence on the field means opponents are going to target fellow Niners corners Ahkello Witherspoon and K'Waun Williams a lot this season.

Lions quarterback Matthew Stafford nearly beat both Witherspoon and Williams with deep passes on multiple occasions, only to see his passes frequently sail high over his intended receivers' heads. Lucky breaks for Witherspoon and Williams.

Witherspoon was relieved late in the game in favor for Jimmie Ward -- a move Shanahan later clarified was intended to give the second-year pro a rest.

Grade: C-

Special Teams


Kicker Robbie Gould was automatic, converting on all three of his field-goal attempts. And rookie wide receiver Richie James almost scored a 104-yard kick return for a touchdown. But that was called back to 90 yards instead after James was flagged for a facemask penalty.

Still, that's pretty good. And this special teams tackle by running back Raheem Mostert should be considered pretty good too:


Grade: A-

For a cumulative grade, the Niners likely wind up with a C. There were elements on both sides of the ball that worked well, just as much as there were ones that didn't.

Unfortunately for Shanahan and Co., they'll have to visit Kansas City in Week 3 and take on second-year quarterback Patrick Mahomes and what is turning into arguably the NFL's most explosive offense this early in the season.

Let's hope San Francisco is able to clean up some of its shortcomings in advance of this massive test.

Peter Panacy has been writing about the 49ers since 2011 for outlets like Bleacher Report, Niner Noise, 49ers Webzone, and is occasionally heard as a guest on San Francisco's 95.7 FM The Game and the Niners' flagship station, KNBR 680. Feel free to follow him, or direct any inquiries to @PeterPanacy on Twitter.