Spencer's 13-yard run put UC Davis (2-9, 2-6 Big Sky Conference) up 7-0 halfway through the first quarter.
Sacramento State (2-9, 1-7) battled to cut the lead to 21-14 when Nate Ketteringham threw 7 yards to Shane Harrison, and Tyler Meeter returned a punt blocked by teammate Garrett Steele 43 yards to score.
But Spencer responded to orchestrate a five-play, 95-yard drive in a little more than two minutes. He completed passes of 31, 23, 22 and his 18-yard touchdown pass to Nehemiah Winston made it 28-14, effectively ending the Hornets' threat.
Ketteringham finished with 296 yards passing and two touchdowns.