The oil deal was signed between the Venezuelan state oil firm subsidiary PDV Caribe and the Intermunicipal Energy Association for El Salvador, which officials said was formed by mayors of the Farabundo Marti National Liberation Front party, or FMLN.
Details of the amount of fuel to be sold were not immediately available.
But Salvadoran officials from FMLN said they hoped to receive about 79,500 litres a month of diesel and gasoline under Venezuela's Petrocaribe initiative, which sells oil directly to Caribbean countries with generous financing.
Under this agreement, cities headed by the FMLN will pay 60% of their oil bill within 90 days while paying for the rest in kind through agricultural products and other locally made goods, said Carlos Ruiz, mayor of Soyapango.
Ruiz said the deal should benefit about 22 cities and towns.
Violeta Menjivar, the mayor-elect of San Salvador, said that oil shipments under the accord were to begin "as soon as possible".
"Great hopes are awakening in our country," she said.
'Deals with the Devil'
Hugo Chavez, the president of Venezuela, used the occasion to criticise US-backed free-trade agreements such as the one El Salvador joined earlier this month, the Central American Free Trade Agreement.
"They're making deals with the Devil, the Devil himself," Chavez told his audience during a signing ceremony on Monday.
Chavez argues that US-proposed pacts such as the Free Trade Area of the Americas would help big US companies at the expense of Latin America's poor.
"We will defeat imperialism, sooner rather than later"
Hugo Chavez, the president of Venezuela
"The FTAA is dead," said Chavez, who has joined Cuba in proposing a "Bolivarian Alternative" trade pact based on socialist principles.
"We will defeat imperialism, sooner rather than later."
Chavez paid tribute at the ceremony to Shafik Handal, the FMLN leader who died in January of a heart attack and who as a rebel years ago fought US-backed troops during El Salvador's civil war.
The FMLN, once backed by Cuba and the Soviet Union, battled conservative US-backed governments until a peace treaty in 1992, when the FMLN transformed itself into a political party.