The law bans “prospection, exploration, exploitation, extraction or processing of metallic minerals in El Salvador,” according to the text published Thursday in the official journal.
“This is more than just a novelty,” the president of the Salvadoran Ecological Unit, Mauricio Sermeno, told AFP.
“It is a law that is necessary in the face of an industry which, far from bringing any benefit to communities, brings serious pollution to water sources and the environment.”
When lawmakers approved the bill in March, non-government campaign group MiningWatch Canada said El Salvador had “made history, becoming the first country to ban metal mining outright.”
Some Latin American countries thrive on mineral exports but local communities complain of environmental risks from toxic metals used in the process.
The new law entered into force after being signed by President Salvador Sanchez Ceren.
El Salvador says it will protect poor rural communities threatened by proposed mining projects.
The country has had disputes with powerful foreign mining firms in the past.
MiningWatch has said it hopes the Salvadoran legislation will set an example for other countries in the region.
This month it seized assets belonging to an Australian-Canadian gold mining group, OceanaGold, for legal fees the company owed after losing a lawsuit over mining permits.
In neighboring Guatemala, rural communities are challenging mining projects by Goldcorp of Canada and two US firms, Tahoe Resources and Kappes, Cassidy & Associates (KCA).
Nicaragua has rejected projects by Canadian company B2 Gold.
Central American countries such as Guatemala, El Salvador and Honduras are among the poorest in the region.
But mining accounts for a minimal portion of their economies and jobs, a recent study by various NGOs showed.