Mr Erdogan said the so-called Islamic State (IS) was behind the attack, which targeted a Kurdish wedding party. Gaziantep, near the Syrian border, is known to have several IS cells.
The bomb wounded 69 people, Mr Erdogan added, 17 of them seriously.
The bomber targeted the wedding guests as they danced in the street.
The BBC’s Seref Isler, who is from Gaziantep, says the city of 1.5 million was already on edge because of events in Syria, where IS has been battling Syrian Kurdish forces.
A suicide bomber believed to have links to IS killed two policemen in Gaziantep in May.
In a written statement published by local media (in Turkish), Mr Erdogan argued there was “no difference” between IS, the Kurdish militants of the PKK, and followers of US-based cleric Fethullah Gulen, whom he blames for the coup attempt last month.
“Our country and our nation have again only one message to those who attack us – you will not succeed!” he said.
The bomb went off in a part of town popular with students and which has a large Kurdish community.
Local MP Mahmut Togrul told the Reuters news agency it had been a Kurdish wedding.
Mr Togrul’s party, the pro-Kurdish Peoples’ Democratic Party (HDP), said the wedding had been for one of its members.
According to a report (in Turkish) by Turkey’s Dogan news agency, the couple had moved to Gaziantep from the Kurdish town of Siirt further east to escape fighting between Kurdish rebels and security forces.
On Sunday morning, smashed garage doors and windows could be seen at the site of the blast, Reuters reports.
“The celebrations were coming to an end and there was a big explosion among people dancing,” said Veli Can, 25.
“There was blood and body parts everywhere.”
The United States condemned the attack, calling it “barbaric act”.
Ned Price, a spokesman for the US National Security Council, said: “We stand with the people of Turkey as they defend their democracy in the face of all forms or terrorism.”
On Saturday, Turkey’s government said the country would take a more active role in efforts to end the war in Syria.