(CNN) -- Turkish Prime Minister Tayyip Erdogan will become the country's first directly-elected president by a wide margin of votes, according the semi-official Anadolu News Agency. Erdogan stopped short of declaring victory when he spoke Sunday night. "We will continue to work for our nation, we will continue to serve our homeland," Erdogan told a crowd in Istanbul. "We will continue our fight for advanced democracy and sovereignty of democracy standards." With nearly 98% of the votes counted, Erdogan avoided a runoff by winning more than 52% of the votes, according to CNN Turk and Anadolu News Agency. Diplomat Ekmeleddin Mehm Ihsanoglu came in second with 38% of the votes.Â Kurdish politician Selahattin Demirtas was a distant third with 9%. CNN's Hande Atay and Chandrika Narayan contributed to this report.
Erdogan avoided a runoff by winning more than 52% of the votes . Erdogan stopped short of declaring victory when he spoke Sunday night . "We will continue to work for our nation," Erdogan told a crowd in Istanbul .