Bukele had 54 percent of the votes with 90 percent of ballots counted.
His biggest challenger, Carlos Callejas of the Nationalist Republican Alliance, was far behind in second with 32 percent, while even further back were former Foreign Minister Hugo Martinez of the Farabundo Marti National Liberation Front and a minor party candidate.
"Today we won the first round and we made history," Bukele said in a victory speech to cheering supporters. "We’ve turned the page on power."
Bukele, the 37-year-old former mayor of San Salvador, is the conservative Grand Alliance for National Unity (GANA) party candidate, and his win will end almost 30 years of a two-party system.
The German Foreign Ministry congratulated Bukele on his victory. "The free and fair elections are a hopeful sign for the country and the region," the ministry said in a tweet.
Other countries and international bodies, including the Organization of American States (OAS), praised the electoral process for being transparent.
All four candidates vowed to end corruption, stamp out gang violence and create more jobs, with cracking down on crime at the top of the agenda.
Since the end of its bloody civil war in 1992, El Salvador has been governed by either the ruling leftist Farabundo Marti National Liberation Front (FMLN) and its rival, conservative Nationalist Republican Alliance (ARENA).
"The two groups that created the war still want to keep governing, and what's more, they're corrupt," Bukele told reporters after voting in the capital.
Bukele made his political debut in 2012 as a small-town mayor with the current-ruling FMLN and won the mayoral election for the capital three years later, automatically making him a potential presidential contender.
Most migrants to the United States from the so-called "Northern Triangle" of Guatemala, Honduras and El Salvador are staying in Mexico for now — because of Donald Trump's new immigration policies.
Image: Reuters/C. Jasso
No longer first choice
In a migrant shelter in the southern Mexican city of Tenosique, near the Guatemalan border, a refugee from Honduras says he originally planned to move to the United States with his family. Trump's election has changed everything. "I wanted to go to the United States with my family, but we've seen that the new government there has made things harder."
Image: Reuters/C. Jasso
Lingering in Mexico
Concepcion Bautista from Guatemala cradles her newborn son in the same migrant shelter. She says she plans to head for the United States, but will linger in Mexico to see how US President Donald Trump's immigration policies play out. Her goal is to reunite with her family up north...
Image: Reuters/C. Jasso
A mere transit country?
…but for the time being, she believes applying for asylum in Mexico is a smarter move. Mexican asylum data and testimony from migrants in Tenosique suggest that although fewer Central Americans are trying to enter the US, plenty are still fleeing their poor, violent home countries, with many deciding to stay longer in Mexico, which has traditionally been a transit country.
Image: Reuters/C. Jasso
Tough immigration policies
The Trump administration has pointed out a sharp decline in immigrant detentions in the first few months of this year as a vindication for the president's tough immigration policies. The measures are already having another effect. In California, where farmers usually rely on workers from Mexico to bring in the harvest, many Mexicans are staying away, preferring to find work in their own country.
Image: Reuters/C. Jasso
Asylum applications on the rise
Migrants from Central America play football in the migrant shelter in Tenosique. The number of people applying for asylum in Mexico has soared by more than 150 percent since Trump was elected president. These days, Mexican immigrants would rather set up in Canada than the United States.
Image: Reuters/C. Jasso
Human smugglers up the price
One man from Guatemala says the prices charged by people smugglers have risen sharply since Trump took office, now hovering around $10,000 (9,100 euros), up from about $6,000 a few years ago. Migrants sit below a mural in Mexico with the words: "Our demand is minimal: justice."
Image: Reuters/C. Jasso
A new home
With Mexico's immigration authorities controlling migration more assiduously, Central Americans were forced to take more isolated, dangerous routes where the chances of being mugged were higher. "We've gone north several times, but every time it's got harder," says one man, who was deported from the United States in December. "Now, it's better if we travel alone, along new routes."