ISTANBUL—Turkish President Recep Tayyip Erdogan’s political party staged a stunning comeback Sunday, winning over voters with its message that one-party rule was the only way to fight a two-front war with Islamic State extremists and Kurdish militants.

Less than six months after losing the majority it had held for 13 years, Mr. Erdogan’s Justice and Development Party, or AKP, regained sole control of Parliament as millions of voters who had been disillusioned with the party returned in force.

The...