A magnitude 4.0 earthquake struck off the coast of Manhattan Beach early Thursday afternoon, the U.S. Geological Survey said.