(Adds comment from president, mayor, details on deaths)
By Alexandra Valencia
QUITO, Aug 12 (Reuters) - Two people were killed in Ecuador on Tuesday after a 5.1 magnitude earthquake struck near the capital of Quito, with eight others wounded and rescue workers still seeking to free others trapped after the tremor.
The National Risk Control Agency said the earthquake triggered a landslide at a quarry in the Quito area that killed two people who worked there, adding that firemen were searching for three others.
"Obviously the landslide was caused by the tremor, but there was already weakness there due to illegal mining ... or quarries being exploited improperly," President Rafael Correa told reporters in the port city of Guayaquil.
Separately, the mayor of Quito reported that only one person died in the landslide and that a 4-year-old boy was killed in another part of the city when sacks of rice fell on top of him.
Social media showed images of dust clouds that had formed after the tremor as a result of shifting earth.
The city's main airport returned to normal operations after earlier halting flights as a precautionary measure to evaluate its infrastructure.
The temblor snarled traffic in the city of 1.6 million and led startled office workers to stream out of buildings.
"We could really feel it. The first thing I did was leave (the building) with my colleagues," said Teresa Salazar, 45, who works at an imports business in northern Quito. "There was nothing major to report, but we were all very nervous."
The U.S. Geological Survey said the moderate quake was only 4.8 miles (7.7 km) deep, with its epicenter located 14 miles northeast of Quito.
(Reporting by Alexandra Valencia, Yuri Garcia and Sandra Maler, writing by Brian Ellsworth; Editing by Mohammad Zargham, G Crosse and Ken Wills)