The BBC's Mark Lowen in Istanbul
The AKP has polled worse than it ever feared and lost its majority. President Erdogan will be unable to change the constitution and extend his powers.
It's a stark contrast with the HDP, which gambled to run as a single party for the first time, hoping to cross the 10% threshold. It paid off, gaining a significant voice for the Kurdish minority on the national stage.
It succeeded by appealing beyond the Kurds, drawing in leftists and staunch Erdogan opponents with its message of equality, gay rights and environmental concerns.
This could be the start of a new political era here; a major setback for a president who has polarised this nation.
In a volatile Middle East, Turkey matters greatly - and so the path it takes, the nature of its democracy and the leaders it produces, all have implications far beyond its borders.