With the victory San Francisco (13-4) locked up the second seed in the NFC. They will host either Seattle or Green Bay in the first round of the playoffs.
Arizona (4-13) struck first when David Blough hit A.J. Green with a 77-yard touchdown strike on the second play of the game.
San Francisco responded with a quick 6 play drive, going 75 yards, and taking the lead on a touchdown pass from Brock Purdy to Christian McCaffrey.
Despite uneven play from the offense over the next three possessions the 49ers would hold on to the lead the rest of the way.