Bukele has touted the use of bitcoin for its potential to help Salvadorans living abroad to send remittances back home, while saying the U.S. dollar will also continue as legal tender.
"It will bring financial inclusion, investment, tourism, innovation and economic development for our country," Bukele said in a tweet shortly before the vote in Congress, which is controlled by his party and allies.
The use of bitcoin will be optional for individuals and would not bring risks to users, Bukele said, with the government guaranteeing convertibility to dollars at the time of transaction through a trust created at the country's development bank BANDESAL.
"Bitcoiners around the world, the time has come," said New Ideas Party deputy William Soriano after the vote. "We did our part, now the ball is on your side."
Under the law, bitcoin must be accepted by firms when offered as payment for goods and services. Tax contributions can also be paid in the cryptocurrency.
Its use as legal tender will begin in 90 days, with the bitcoin-dollar exchange rate set by the market.