"It was long - 30 to 40 seconds. It didn't stop. Everything was moving fast. I could see the floor rolling," one Chino Hills resident told Reuters.
Los Angeles city officials evacuated City Hall as a precaution, while some restaurants could be seen evacuating workers and customers, officials said.
Witnesses reported feeling strong shaking in neighbouring Orange County and as far south as San Diego.
Officials at Los Angeles International Airport said there were no flight delays as a
result of the quake.
California is highly susceptible to earthquakes and Los Angeles is in particular danger, lying near the so-called San Andreas Fault, a geological fault that runs through the state.
Geologists say an earthquake capable of causing widespread destruction is 99 per cent certain of hitting California within the next 30 years.
Experts have warned that an earthquake of a magnitude of around 8.0 could cause devastation and huge loss of life in the city.
The last major earthquake to hit California was in 1994, when a 6.7 magnitude earthquake hit the Los Angeles neighbourhood of Northridge, killing dozens of people and causing billions of dollars worth of damage.
Magnitude five earthquakes are considered moderate but are still capable of causing considerable damage, particularly if they are close to the earth's surface.
The USGS said Tuesday's quake was shallow, at only 13.6km deep.
Los Angeles is the most populous city in California and the second-most populous urban area in the US, with a population of about 3.8 million, according to the last US Census Bureau estimate in 2006.