The Santa Ana or Ilamatepec volcano, 66km west of the capital, rumbled and belched thick plumes of ash that reached more than 15km into the sky on Saturday morning.
Military emergency sirens blasted, calling for an immediate evacuation of the hamlets in the coffee growing area, and soon after, the volcano began hurling glowing rocks and ash from its crater.
The volcano "has begun to expel magma on the side of the town of San Blas, while the ash is being carried by a south-southwesterly wind", University of El Salvador vulcanologist Francisco Barahona said.
Officials with the National Emergency Committee said that by 1900 GMT, 2250 people had been evacuated from the danger zone.
Hot rocks belched out by the volcano ranged from the size of a football to the size of a car. At least seven people were injured by red-hot rocks spewed into the air by the eruption, the national police said.
Two people were killed when 200 residents fled the hamlet of Palo Campana, just 2km from the crater, said Interior Minister Rene Figueroa.
The eruption triggered a landslide of boiling mud and water from a crater lake that rushed down onto Palo Campana from three directions, the authorities said.
Interior Ministry officials declared a red alert in a 4-km radius around the volcano. A lesser "yellow alert" was issued for adjacent areas. About 20,000 people live in the area surrounding the volcano.
President Antonio Saca called on El Salvadorans to remain calm, describing the eruption as one of "moderate magnitude".
The country's civil protection forces have been deployed and are operational, he said.
Saca said he understood many people had never seen a volcano erupting and would like to get close to observe the phenomenon.
"This is not a game," he warned. "This could represent danger since we are not discounting another eruption."
At 2381 meters above sea level, the Santa Ana volcano is the highest point in El Salvador. It last erupted in 1904.
Santa Ana, the country's second-largest city with a population 100,000 and 40km from the volcano, was not affected, officials said.