Mason Crosby kicked a 27-yard field goal as time expired to cap an 81-yard drive set up by Kevin King's interception with 1:07 left, and the Green Bay Packers outlasted the San Francisco 49ers for a 33-30 win on Monday night.

The drive was extended after 49ers cornerback Richard Sherman was called for an illegal contact penalty on third-and-15 that wiped out a sack of Rodgers with 43 seconds left.

Rodgers later rushed up the middle for a 21-yard gain. The two-time NFL MVP then completed two more passes for 19 yards to set up Crosby's game-winner for Green Bay (3-2-1).

San Francisco 49ers wide receiver Marquise Goodwin (11) celebrates a touchdown during the first half of an NFL football game against the Green Bay Packers Monday, Oct. 15, 2018, in Green Bay, Wis. (AP PhotoMatt Ludtke)

San Francisco 49ers wide receiver Marquise Goodwin (11) celebrates a touchdown during the first half of an NFL football game against the Green Bay Packers Monday, Oct. 15, 2018, in Green Bay, Wis. (AP PhotoMatt Ludtke)

The veteran kicker was perfect a week after missing four field goals in a loss at Detroit.

Rodgers threw for 425 yards and two scores.

C.J. Beathard passed for 245 yards and two touchdowns for the 49ers (1-5).

More AP NFL: https://apnews.com/tag/NFL and https://twitter.com/AP_NFL