Parliament began voting at 3pm (1200 GMT), and the ruling Justice and Development Party (AKP), which holds 341 seats in the 550-member parliament, had no trouble in installing Gul, 56, as president.
The AKP only needed an absolute majority to secure the post. In the previous two rounds in the chamber, they failed because a two-thirds majority was required.
Two other candidates also stood for president.
General Yasar Buyukanit, Turkey's armed forces chief, said on Monday he saw "centres of evil" seeking to undermine the secular republic, a statement suggesting the army would not stand on the sidelines if it saw the separation between mosque and state threatened.
"The Turkish armed forces will not make any concessions ... in its duty of guarding the Turkish Republic, a secular and social state based on the rule of law," he said in a written message.
Barnaby Phillips, Al Jazeera's correspondent in Ankara, said: "The army sees itself as the guardian of the secular constitution [but] Gul laughs off suggestions that he harbours a secret Islamist agenda."
The Milliyet newspaper said: "Gul's election will be a turning point in our political history that could draw us one step closer to democratic maturity."
Liberals dismiss concerns over the secular system - a defining feature of the Turkish republic - as "fear-mongering" undertaken by political rivals unable to match the AKP's rising popularity.
They see Gul's presidency as symbolic of the rise of the conservative and impoverished masses who form the backbone of the AKP - people who have long been kept at the margins of politics by the army-backed secularist elite, critics argue.
"Secularism - one of the main principles of our republic - is a pre-condition for social peace as much as it is a liberating model for different lifestyles.
"As long as I am in office, I will embrace all our citizens without any bias. I will preserve my impartiality with the greatest of care."
Turkey's popular Vatan newspaper said: "Gul will not have an easy start. His every step ... will be under scrutiny by institutions and sections of society who are sensitive on secularism.
"Gul will neeed to be careful and make efforts to calm them."
When Gul first stood for the presidency in April, the opposition blocked his election by boycotting parliament, while the army, which has ousted four governments since 1960, warned the government that it was "ready to defend" the secular order.
|The headscarf debate has |
beleaguered Gul [AFP]
The crisis forced Recep Tayyip Erdogan, the Turkish prime minister, to call early general elections on July 22, from which the AKP emerged with a huge victory, hailing it as popular support to re-nominate Gul.
Opponents charge that the AKP has a secret agenda to replace Turkey's secular order with a regime more akin to an an Islamic republic.
Uncompromising secularists are also irritated by the fact that Gul's wife wears the Islamic headscarf, which they see as a symbol of defiance of the secular system.
But a survey published in Milliyet on Tuesday showed that the majority of Turks - 72.6 per cent - have no objections to a first lady with a headscarf, while 19.8 per cent said they would be annoyed if she covers up.