
Alfredo Pacheco, who played for the small Central American country from 2005 to 2013, was approached by unidentified assailants in the city of Santa Ana early on Sunday, according to the Attorney General's office.
The attackers were in a vehicle and opened fire on Pacheco and his friends - killing him and injuring two more.
Pacheco became club captain of one of El Salvador's biggest teams, FAS, in 2005, and represented the country 86 times - eventually becoming its most-capped player.
He also played for Metapan and Aguila, and had a loan spell at New York Red Bulls, as well as for the El Salvador national team.
In 2013 he was one of 13 members of the national team who were banned for life by the Salvadoran Soccer Federation in 2013 - a punishment ratified by Fifa - for match-fixing.
The troubled South American country, which borders Guatemala and Honduras, saw its highest murder rate in August this year since the 12-year civil war which ended in 1992.