Jimmy Garoppolo threw two touchdown passes, Matt Breida ran for 138 yards and San Francisco's longest TD run in four seasons, and the 49ers bounced back from a season-opening loss by beating the Detroit Lions 30-27 on Sunday.
Garoppolo nearly made a costly mistake when he threw a late interception to Tracy Walker that was returned to the San Francisco 7. But Quandre Diggs was called for a defensive holding away from the play to give the 49ers (1-1) a first down.
Garoppolo played turnover-free ball a week after throwing three interceptions in a 24-16 loss at Minnesota that led to his first defeat as a starter following seven straight wins.
He threw a 4-yard TD pass to Kendrick Bourne in the second quarter and an 11-yarder to Garrett Celek in the third to hand Matt Patricia, his old friend from their New England days, a second straight loss to begin his tenure as coach of the Lions (0-2). Garoppolo finished 18 for 26 for 206 yards, but was sacked six times.
Breida did much of the rest by gaining 159 yards from scrimmage and breaking the game open with a 66-yard touchdown run in the third quarter that was the longest for San Francisco since Colin Kaepernick scored on a 90-yard run against the Chargers on Dec. 20, 2014.
Matthew Stafford was much sharper than he was last week for the Lions when he threw four interceptions. He went 34 for 53 for 347 yards, three touchdowns and no interceptions but it wasn't enough.
He threw TD passes in the fourth quarter to Marvin Jones Jr. and Michael Roberts but was unable to lead another scoring drive after taking over at the 16 with 1:08 to play. He threw an incomplete pass to Theo Riddick on fourth-and-2 from his 39 with 14 seconds left, ending the comeback attempt.
Detroit running back LeGarrette Blount was ejected in the third quarter. Blount took exception to Elijah Lee pushing Stafford as he stepped out of bounds. Blount was standing on the sideline right in front of the play and went on the field and pushed Lee. Blount was assessed a personal foul and ejected.
The Lions once again struggled coming out of halftime. Detroit was outscored 31-7 in the third quarter in a loss to the Jets last week and then 14-3 by the 49ers in this game.
The 49ers had three drives stall after getting inside the red zone in part because Detroit sacked Garoppolo three times on plays that started inside the 20. That led to three field goals for Robbie Gould, giving him 29 straight makes, two more than Phil Dawson's franchise record set in 2013.
Rookie D.J. Reed started the second half with a long kickoff return that initially appeared to go for a touchdown. But he was called for a facemask penalty while giving a stiff arm and was only credited with a 90-yard return, the longest for the Niners since Kyle Williams had a 94-yarder in 2012. San Francisco still managed to get a TD with a 26-yard drive capped by Garoppolo's pass to Celek.
Lions CB Darius Slay left the game with a concussion in the third quarter.
Injured 49ers WR Marquise Goodwin raised his fist during the national anthem. No other player had a visible protest.
Lions: Host New England on Sunday night.
49ers: Visit Kansas City on Sunday.