The Guls, behijabbed and triumphant
Mr Gul was elected in a third round of voting, after months of tension between Turkey's ruling Islamist-rooted AK Party and the secular establishment.
The vote came a day after a new warning from the military about attempts to undermine the secular constitution.
Mr Gul, whose wife wears a Muslim headscarf, has pledged to respect Turkey's secular institutions.
The AKP, which won recent snap polls, needed only a simple majority in the third round of voting.
Turkey's military chief warned on Monday that "centres of evil" were trying to undermine the state.
Gen Yasar Buyukanit did not name those he said were "trying to corrode the secular nature of the Turkish Republic."
But analysts said the statement was clearly aimed at Mr Gul, a devout Muslim. Turkish MPs elect Gul president (more)
WATCH BBC VIDEO:
Turkey Set for New Leader
REUTERS:
Turkey's Gul stirs hope among devout Muslims
Mark Alexander