A 5.2 magnitude earthquake has occurred northeast of San Diego, according to the United States Geological Survey.