A 3.7 preliminary magnitude earthquake struck about 5 kilometers off the coast of San Francisco, according to the U.S. Geological Survey.