"[This is an act of] terrorism and I call it that because there is no doubt that the attackers were trying to sow terror in the population."
In another incident, gang members boarded a minibus and shot at passengers. Two girls and one adult were killed in that attack.
Police say the motives are not clear, but some Salvadorans say it may be a warning to bus operators that refuse to pay extortion to criminal gangs.
Gang violence in El Salvador leaves on average about 13 people murdered each day, along with dozens of cases of armed robbery.
"Innocents died," Carlos Ascencio, the police chief, said about the bus attacks.
"It's a sad fact. Let's get to the bottom of the whole thing because this is an act of terrorism that we will not let go unpunished."
Since late last year the government has moved to crack down on gangs, deploying 4,000 troops to reinforce police in providing security in the streets.
Youth gangs, which largely started in the United States and expanded in El Salvador when criminal immigrants were deported back home, run large extortion rings in the country, demanding payments from bus drivers and store owners under the threat of death.
Branches of the same gangs can be found across Central America.