An earthquake shook near the Gilroy area of Santa Clara County on Tuesday, according to the U.S. Geological Survey.