The vote was seen by many as a referendum on whether to give Erdogan more presidential powers. But with just under 41 percent of the vote, down from 49 percent in 2011, the result was a major blow.
Turkey could now face weeks of uncertainty as parties try to form a coalition. If they fail, more elections could be called in less than two months.
The Republican People's Party (CHP) won 25 percent of the vote, the Nationalist Movement Party (MHP) about 16 percent and the pro-Kurdish Peoples' Democratic Party (HDP) 13 percent.
The MHP and HDP have both ruled out forming a coalition with the AK Party, so the ball may lie in the court of the CHP – but it's a secular party and longtime critic of the AKP.
The CHP's leader Kemal Kilicdaroglu told supporters: “We ended an autocratic era through democratic means. Democracy has won. Turkey has won."
Another winner in Sunday's vote was the HDP party, which
proved it could broaden its appeal to left-leaning voters and other minorities.
It's the first time a pro-Kurdish party has passed the 10 percent electoral threshold – enough to enter parliament.
In Diyarbakir, the main city in Turkey's mostly Kurdish southeast, celebrations continued throughout Sunday night.
Source: euronews