The bill advanced in Thursday's last hours of the legislative session and was sent to Gov. Jerry Brown, who has until Oct. 13 to act on it.
The alerts could appear on freeway signs, as well as on TV or radio or through apps.
The statewide sensors would give people up to 60 seconds of warning before a major earthquake.
While a few seconds may not sound like much time, supporters say it's enough notice for trains to slow down, utilities to shut off gas lines or people to duck under a table to ride out the shaking.
Early warning can't predict earthquakes before they happen and is useless at the quake's origin since there is no time to detect passing waves.
Researchers previously estimated a statewide alert system would cost about $80 million to build. The bill would require state emergency officials to determine how to fund the system by 2016.
The Associated Press contributed to this report.