The Rams (11-1) also moved a step closer to earning home-field advantage in the NFC playoffs, taking a one-game lead over New Orleans after it lost to Dallas on Thursday night. It is a cushion Los Angeles needs because its only loss was against the Saints last month.
The Lions (4-8) have lost five of six since a surge of success gave them a winning record in late October.
Detroit's defense held Los Angeles' high-powered offense in check for three quarters, giving the slumping team a shot to potentially pull off a stunning upset. The Lions, though, failed to make the most of the opportunity because their offense struggled to move the ball and score.
Aaron Donald helped seal the win by forcing Matthew Stafford to fumble midway through the fourth quarter. The star defensive tackle had two strip-sacks in his last game on Nov. 19, a 54-51 win over Kansas City.
Linebacker Samson Ebukam recovered Stafford's fumble at the Detroit 24 and Gurley scored on a 13-yard run three snaps later, giving the Rams a 23-13 lead.
Jared Goff, perhaps rusty coming off a bye week, was off the mark on many passes and lost a fumble to help keep the game close. His lackluster performance led to Los Angeles settling for Greg Zuerlein kicking three field goals. Goff was 17 of 33 for 207 yards with a tie-breaking 8-yard touchdown pass to Robert Woods late in the second quarter. Goff also threw an interception on an overthrown pass in the second quarter and lost a fumble in the third period.
The Rams were able to lean on Gurley, who has a single-season franchise record with 15 rushing touchdowns. The standout running back also caught three passes for 33 yards.
Stafford was 20 of 33 yards for 245 yards with an 11-yard touchdown pass to tackle Taylor Decker, who faked the Rams out by blocking for a moment before releasing into the flat, where he was wide open. Decker's touchdown pulled Detroit within three points late in the third quarter.
The Lions had a chance to cut the deficit to three again late in the game, but Kenny Golladay couldn't get both feet in the end zone on a pass from Stafford. They had settle for Matt Prater's third field goal.
Gurley converted a third down on the ensuing drive and after breaking free, he chose not to score to run more time off the clock and force Detroit to take timeouts. It proved a good move because Gurley ran for a 2-yard score with 1:54 left.
The Lions' final drive that ended with Troy Hill intercepting a pass in the end zone with 12 seconds left.
Rams: RB Malcom Brown left with a shoulder injury. CB Aqib Talib played for the first time since going down with an ankle injury in Week 3.
Lions: LB Devon Kennard went out with a hip injury.
Rams: Play at Chicago on Sunday night.
Lions: Play at Arizona on Sunday.