Prime Minister Recep Tayyip Erdogan swept to a landslide victory in Turkey’s first direct presidential election, extending his 12-year grip on power and securing a mandate to fulfill his pledge of creating a “new Turkey.” The country’s election board announced Mr. Erdogan had won according to preliminary results, obtaining enough votes to avoid a runoff. With 99% of the ballots counted, the premier had secured 52%, far ahead of his nearest opponent Ekmeleddin Ihsanoglu, a diplomat with a low profile in domestic politics who garnered 38% of the vote, according to state-run Anadolu news agency. In a victory speech to thousands of flag-waving supporters at his governing Justice and Development Party’s Ankara headquarters, Mr. Erdogan called for societal reconciliation after a brutal campaign that was widely seen as hardening divisions across the country. But he also warned his political enemies against undermining Turkish security. “Without a doubt, new Turkey, great Turkey, leading Turkey has won today. We are closing the doors on one era, and we are now taking our first step to a new phase,” Mr. Erdogan said. “We will face down whoever threatens our national security.” Turkey’s main opposition Republican People’s Party warned Sunday that Mr. Erdogan’s victory would herald the creation of a more authoritarian system centered around his personal appeal. Recep Tayyip Erdogan is remembered with his historic visit to Mogadishu in 2011, becoming the first leader to come to the war-torn city in two decades.