Erdogan won 52.5 percent of the vote, compared to 31.5 percent for his nearest rival, Muharram Ince of the People's National Party (CHP).
The result is a blow to the opposition, who, buoyed up by massive rallies for Ince in the last three days of campaigning, had hoped to force the incumbent to a deciding round.
With an 88 percent turnout, "Turkey has given a lesson in democracy to the entire world." Erdogan declared at his Istanbul residence.
Ince did not make a statement during the evening but the CHP accused Anadolu of announcing a result it claimed was based on 90 percent of votes when only 40 percent had been counted.
"I hope nobody will harm our country's democracy by casting a shadow on the election system and its results in order to disguise their failure," Erdogan said.
There have been unverified allegations of intimidation and vote fraud on social media.
An official of the Iyi (Good) Party, Mehmet Sıddık Durmaz, was shot dead in the eastern province of Erzurum.
The Supreme Election Board on Monday announced that it will look into claims of vote-rigging in the Suruc district of the south-eastern province of Sanlıurfa.
Both the AKP and the CHP fought the parliamentary poll as leaders of electoral alliances - the People's Alliance and the National Alliance, respectively.
That strategy paid off for the AKP, which would not have had an absolute majority on its own.
The Islamic party will be able to rule in coalition with a former arch-enemy, the hard-right Nationalist Movement Party (MHP).
The alliance has won 342 out of 600 seats.
The MHP defied predictions that it would suffer badly for its support for Erdogan and a split by former interior minister Meral Aksener, who formed the Iyi Party.
The MHP won 50 seats.
Aksener won about seven percent in the presidential poll, behind the HDP's Selahattin Demirtas, which campaigned from jail.
The CHP-led alliance won 34.03 percent of votes, with Ince's party taking 22.7 percent.
Kurdish party returns to parliament
The HDP succeeded in winning 11.5 percent - lower than it scored in the first of 2015's two parliamentary elections but higher than the 10-percent bar parties have to pass to have seats in parliament.
With 65 seats, it will be the third largest parliamentary group.
Some left-wing Turks voted for Ince in the presidential election and the HDP in the parliamentary one, attracted by its progressive policies and believing that the country's largest ethnic minority needed a voice in parliament.
Some commentators also believe that there was a tactical element to the support, since it reduced the AKP's representation.
Other opposition voters consider the HDP too close to the PKK, a charge that Erdogan repeated throughout the campaign.
State of emergency
The election took place against the backdrop of a state of emergency, declared after the 2016 coup attempt.
Most of the HDP's leadership, including Dermitas, are in jail awaiting trial on terrorism charges linked to alleged links to the Kurdistan Workers' Party (PKK) separatist guerrillas and many polling stations in the Kurdish-majority south-east were moved for "security" reasons.
A clampdown on the media has seen most independents broadcasters and newspapers closed and Erdogan and the AKP received vastly more coverage than the opposition.
War, executive presidency, economy
Speaking in Ankara early on Monday morning, Erdogan vowed to carry on fighting "terroristic organisations", a reference to the PKK, whose bases in northern Iraq the army has attacked, and to the supporters of US-based cleric Fehtullah Gulen, who is accused of being behind the failed coup.
He also said he would "continue to fight to make the Syrian grounds freer", following the Turkish army's capture of Afrin from the Syrian-Kurdish People's Protection Units, who are linked to the PKK.
Constitutional changes approved in a referendum last year will now come into effect, abolishing the post of prime minister and creating an executive presidency with extensive powers.
The Turkish lira, which has fallen on the money markets recently, rose one percent in Asia on the announcement of the election result but, with 12 percent inflation, high unemployment and a huge current account deficit, the new government will have major economic challenges.