Congress approved President Nayib Bukele's proposal to embrace the cryptocurrency, with 62 out of 84 possible votes on Tuesday night.
The president said the government had made history, and that the move would make it easier for Salvadoreans living abroad to send money home.
The new law means every business must accept Bitcoin as legal tender for goods or services, unless it is unable to provide the technology needed to do the transaction.
"It will bring financial inclusion, investment, tourism, innovation and economic development for our country," President Bukele said in a tweet shortly before the vote.
The #BitcoinLaw has been approved by a supermajority in the Salvadoran Congress. 62 out of 84 votes! History! #Btc🇸🇻
El Salvador's economy relies heavily on remittances, or money sent home from abroad, which make up around 20% of the country's gross domestic product (GDP).