MINNEAPOLIS (AP) Brian Hoyer had the San Francisco offense humming, an encouraging performance for one of the league's lowest-scoring teams over the last three years.

Sam Bradford and the Minnesota starters failed again to reach the end zone, allowing concerns about the offensive line to smolder.

After sputtering through the first two preseason games, Hoyer passed for 176 yards and two touchdowns for the 49ers in the first half before the Vikings rallied for a 32-31 victory on Sunday night.

''It was a relief, because as an offense I knew that's who we were,'' said Hoyer, an unchallenged starter for the first time in his nine-year career.

Hoyer found Marquise Goodwin wide open for a 46-yard scoring strike and Carlos Hyde out of the backfield for a 24-yard touchdown connection, some evidence of how new coach Kyle Shanahan's scheme could pick up the pace. Goodwin, the former Olympic long jumper who had the fastest 40-yard dash time at the 2013 NFL combine, ought to help after injuries buried him in Buffalo.

''It's important to get a start like that, especially when we've got a new team,'' Goodwin said. ''The chemistry is starting to develop.''

The backups were buzzing, too, with an 87-yard score by Raheem Mostert off a screen pass from C.J. Beathard on third-and-22 in the third quarter and a short touchdown run by Mostert in the fourth quarter.

This all came against a defense that has been one of the league's most difficult to score against under coach Mike Zimmer.

''Even though this doesn't count, it becomes an issue right now,'' defensive end Everson Griffen said.

For the Vikings, Jerick McKinnon scored on a 108-yard kickoff return in the third quarter to boost his bid to take over that role. Backup quarterbacks Case Keenum and Taylor Heinicke led the late charge, with two touchdown passes by Keenum fueling the comeback and Heinicke's hurdle over the pylon for the 2-point conversion on the final play sealing the win after Terrell Newby's touchdown run with no time left.

With left tackle Riley Reiff, running back Latavius Murray and wide receiver Laquon Treadwell all playing their first preseason game, Bradford and the Vikings were closer to full strength. But the protection was again problematic, and Stefon Diggs dropped two passes.

In 13 possessions for the first team over their first three games this month, the Vikings produced 11 punts and one field goal while allowing five sacks of Bradford. They reached the 6-yard line in the second quarter but ran out of time before they could try another play.

Zimmer's assessment of the offensive line was ''sporadic'' play.

''It's hard to see which guys are getting beat from where I'm at,'' Zimmer said, ''if they're getting beat.''

QB COMPS

49ers: Hoyer finished 12 for 17 with a 143.3 passer rating.

Vikings: Bradford was 17 for 21 for 134 yards and no turnovers.

BACKUP BATTLES

Beathard took another step toward solidifying himself as Hoyer's sidekick, entering before Matt Barkley. The depth chart behind Hyde at running back is wide open, with Mostert (130 yards, six touches) and rookie Matt Breida (34 yards, eight touches) standing out.

REID PROTEST RESUMES

San Francisco strong safety Eric Reid observed the national anthem from one knee , in resumption of the human rights protest he joined last season with then-teammate Colin Kaepernick. Goodwin and others had their hands on Reid's shoulders.

Reid later drew the ire of Vikings wide receiver Adam Thielen after lowering his shoulder into Thielen's chest during a reception in the second quarter. Reid kissed his flexed biceps muscle like Kaepernick used to do, before receiving an earful from Thielen, who downplayed the response afterward.

KICKING CONTEST

Marshall Koehn made a 58-yard field goal for the Vikings with room to spare, keeping the competition with Kai Forbath for the kicker job close. Koehn missed a 47-yard attempt a few minutes later after Antone Exum's interception, but he made all three extra points and sent all five kickoffs to the end zone, with four touchbacks. Forbath did not see action.

SITTING OUT

49ers: FS Jimmie Ward (hamstring) was held out after being taken off the physically unable to perform list earlier in the week.

Vikings: TE Kyle Rudolph (leg) and DE Brian Robison (undisclosed) didn't suit up.

NOTABLE INJURIES

49ers: Five-time Pro Bowl LT Joe Staley was sidelined in the first quarter because of a knee injury, but he was walking around without displaying obvious discomfort or discouragement. ... LB Brock Coyle (knee) departed in the third quarter.

Vikings: LB Emmanuel Lamur left in the third quarter for a concussion evaluation. FS Anthony Harris (leg) was out in the fourth quarter.

---

For more AP NFL coverage: http://pro32.ap.org and https://twitter.com/AP-NFL

Copyright 2017 by STATS. Any commercial use or distribution without the express written consent of STATS is strictly prohibited.