With 62 out of 84 possible votes, lawmakers voted in favor of the move to create a law to adopt bitcoin, despite concern about the potential impact on El Salvador's program with the International Monetary Fund.
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.
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.
Cryptocurrency supporters hailed the move as legitimising the emerging asset, but its impact on bitcoin regulation, taxation or adoption in other countries remains to be seen.
Still, there were no immediate signs that other countries would follow El Salvador's embrace of bitcoin.
"Whether this becomes the first in what becomes a trend and then snowballs, or whether this will be a blip, we will only know through history," said Brandon Thomas, partner at advisory firm Grayline Group.
Analysts have also said the move could complicate talks with the IMF, where El Salvador seeks a more than $1 billion program.
Bitcoin enjoyed its best day in two weeks, rising as much as 6 percent to $35,200.
"The market will now be focused on adoption through El Salvador and whether other nations follow," said Richard Galvin of crypto fund Digital Asset Capital Management. "This could be a key catalyst for bitcoin over the next two to three years."
Emerging economies — where bank penetration is much lower than in developed countries and reliance on money transfers from abroad much higher — have quickly warmed to cryptocurrencies.
Outside the United States, countries with the highest crypto production and trading volumes are all developing nations, according to the Bank of America (BofA), including China, Colombia and India.
But the use of digital currencies in general can also pose risks for dollarized economies, which have adopted foreign currencies as legal tender, such as El Salvador, it added.
Dollarization "is a major problem for macro and financial stability in many emerging markets, and it could worsen if digitalization facilitates access to foreign currencies," said David Hauner at BofA.
El Salvador relies heavily on money sent back from workers abroad. World Bank data showed remittances to the country made up nearly $6 billion or around a fifth of GDP in 2019, one of the highest ratios in the world.
It is not clear what proportion of remittances sent to El Salvador are in the form of bitcoin.