Results broadcast by Turkish media showed Prime Minister Tayyip Erdogan had won the first presidential election.