A magnitude 4.9 quake struck northwest of Bakersfield, California, on Tuesday, the U.S. Geological Survey said.