The bill will now go to the state Assembly for consideration next month, the Los Angeles Times reported Monday.
The passage in the Senate comes as Google Inc., Caltech and other groups are busy developing vehicles that use radar, video cameras and lasers to navigate roads and drive in traffic without human intervention.
By law, self-driving cars must have a person behind the wheel, ready to take over control in case of a malfunction.
Several lawmakers test-drove Google's prototype autonomous Prius and "came away convinced that fostering this technology is the right direction for California," the bill's sponsor, Sen. Alex Padilla, D-Pacoima, said.
"Human error is the cause of almost every accident on the road today. If autonomous technology can reduce the number of accidents, then we also reduce the number of injuries and fatalities on California's roads," Padilla said. "For me this is a matter of safety."
Nevada signed similar legislation into law last year and Arizona, Hawaii, Florida and Oklahoma are all considering autonomous-vehicle legislation, the Times reported.