(Adds color, storm preparations, updates power outages)

By Curtis Skinner

SAN FRANCISCO, Dec 11 (Reuters) - Heavy rain and high winds lashed northern and central California on Thursday, knocking out electricity to tens of thousands of homes in the San Francisco Bay area and prompting school closures across the region as a major storm moved in from the Pacific.

Winds howled through Sacramento, the state capital, with gale-force gusts rattling buildings and whipping through trees before dawn, followed by heavy downpours just as the morning commute was getting started.

The National Weather Service issued flash-flood, high-surf and high-wind advisories ahead of the storm, warning that torrential rains could lead to mudslides in foothill areas stripped of vegetation earlier in the year by wildfires.

The Pacific Gas and Electric Company reported that more than 77,000 customers lost power during the storm early Thursday, with cities in the peninsula area south of San Francisco hardest hit by outages.

Several Bay area school districts, including San Francisco, Oakland and Berkeley, canceled classes due to the storm.

Municipalities handed out sandbags to help residents ward off flooding and reminded people to prepare for the storms by stocking emergency supplies, routines that had become unfamiliar amid years of drought.

Supermarkets on Wednesday night were emptied of bottled water, and in Sacramento a Radio Shack store on Fair Oaks Boulevard was running low on batteries as a constant stream of customers ran in and out.

At an adjacent SaveMart supermarket, shoppers combed the aisles for prepared foods that could be served without cooking in the event of an extended blackout.

Wind gusts peaking at 50 mph (80 kph) were recorded on the Sonoma County coast north of San Francisco, the National Weather Service said early Thursday.

Weather officials predicted the storm could drop as much as 4 inches (10 cm) of rain on the area, with a heavy band of showers expected to sweep the Bay area on Thursday morning.

"The fact that it looks like so much of it is going to fall in such a short period of time, that's one of the major concerns," Weather Service meteorologist Charles Bell said.

The storm was expected to spread into Southern California by Thursday night.

Residents were warned to stay off jetties and rocks along the coast as heavy surf pounded beaches.

"It's common sense. If you look out and the surf looks like a gigantic washing machine, most people know they shouldn't go in there," Weather Service meteorologist Mark Jackson said. (Reporting by Curtis Skinner; Additional reporting by Sharon Bernstein in Sacramento, Dan Whitcomb in Los Angeles and Fiona Ortiz in Chicago; Writing by Sharon Bernstein and Steve Gorman; Editing by Crispian Balmer, Bill Trott and Eric Beech)