People won’t be forced to use Bitcoin and the US dollar will remain the country’s official currency.
Mr Bukele said his government had made history by becoming the first nation to use Bitcoin as legal tender.
Other countries in South America, including Venezuela and the Bahamas, have introduced digital currencies, though none had adopted the original cryptocurrency, Bitcoin.
Mr Bukele has said the move would increase financial inclusion, investment, tourism, innovation and economic development.
More on Bitcoin
The law will take effect 90 days after its official publication and the Central Bank and financial regulators will publish implementing rules in the meantime.
Mr Bukele’s New Ideas party holds a supermajority in the new congress, which was seated on 1 May.
Bitcoin is an alternative to state-backed currency and no central bank or other financial institutions have any say in its value, which is set entirely by people trading it, and the exchange rate between it and the US dollar in El Salvador will be set by the market.
The legislation established a government trust fund that will guarantee automatic convertibility to dollars.
Carlos Carcah, a professor at El Salvador’s Superior School of Economics and Business, argued that adoption of Bitcoin as legal tender “is not necessary, nor convenient”.
He added: “As long as there is someone who accepts payment with Bitcoin, the same as they accept dollars, there wouldn’t be problems.”
He noted that Bitcoin is extremely volatile, so investors “run the risk of becoming rich and the next day being poor”.