Mr Erdogan said that "democracy has passed a very important test"
Mr Erdogan also said his Islamist-rooted AK Party would seek national unity and respect Turkey's secular constitution.
Unofficial results gave the AK Party about 47% of the vote, prompting wild street celebrations by supporters.
Opponents have warned that an AKP win could undermine Turkey's secularism.
The election was called after opposition parties in parliament blocked the AK Party's nominee for the post of president, causing political deadlock.
But despite his election win, Mr Erdogan will lack the two-thirds parliamentary majority to force through his presidential choice.
In the capital Ankara, Mr Erdogan told jubilant supporters that the AKP victory was a triumph for democracy.
He promised to "press ahead with reforms and the economic development that we have been following so far".
"We will continue to work with determination to achieve our European Union goal," he said.
The prime minister also vowed to continue the fight against Kurdish rebels in the east of Turkey.
Fewer seats
Although the AKP has been returned to power with a larger share of the vote, the presence of a third political party in the parliament means it will have fewer seats, the BBC's Pam O'Toole says.
The AKP's 47% means it would get up to 341 seats in the 550-member parliament.
Two opposition parties won the 10% share needed to guarantee seats in parliament - the secularist Republican People's Party (CHP) polled 20%, and the right-wing Nationalist Action Party (MHP) 14%.
Estimates said the CHP would win up to 112 seats and the MHP some 70 seats, with up to 27 going to independent candidates, including pro-Kurdish politicians.
'Ringing endorsement'
The election was touted as one of the most important in Turkey's history and turnout was reported to be extremely high, with many people breaking off holidays to return home to vote.
The key test now, says the BBC's Sarah Rainsford in Ankara, will be who the party puts forward for president and whether or not it is willing to compromise.
HAVE YOUR SAY As a secular Turk I have every confidence that Turkey has a great future in the hands of Prime Minister Erdogan and his party.
Dr Hasan Ferit Boysan, London
Send your reaction
He is a devout Muslim and his wife wears the Islamic headscarf.
It is not clear how the staunchly secularist military will react to the re-election of the AKP.
During the deadlock over the presidency, the army said it was prepared to step in to defend Turkey's secular system.
The current president, Ahmet Necdet Sezer, and the secularist establishment have vowed to resist what they regard as the Islamist agenda of the AKP.
Mr Erdogan's government dismisses that portrayal, pointing to its record of five years of economic growth and the start of membership negotiations with the EU.
And, our correspondent says, with this massive of vote of confidence in the AKP, almost half of the population have turned out to show they do not believe it is any threat to Turkey's secular system.
With such a clear mandate, the AKP may be tempted to nominate Abdullah Gul again, she says, though most believe the party will look for consensus to avoid dragging the country back into chaos.
The Justice and Development Party (AKP) in Turkey secured a solid mandate in Turkish general election, held yesterday. Although Prime Minister Recep Tayyip Erdoğan could celebrate getting 46.5% of the vote, more than 12% better than the last poll in 2002, his party will have to settle for slightly fewer seats in Turkey's parliament, the Grand National Assembly of Turkey. AKP will now have 340 seats versus 353 formerly.

Before a cheering crowd, Erdoğan said yesterday: "We've passed an important test of democracy that is an example to the world. The people have pronounced the Justice and Development Party as the central political power in Turkey."
Abdullah Gül in 2005 
AKP called this election, ahead of schedule, after opposition parties boycotted the vote on AKP's presidential candidate, Abdullah Gül, and the Constitutional Court annulled the result. Speaking about the issue of the presidency, Erdoğan told a news conference: "We will resolve this matter without causing tensions."

United Kingdom Foreign Secretary David Miliband, said: "It's very important that across Europe we reach out to the new government in Turkey when it is formed. A stable and secure Turkey is massively in our interests."

In Washington, spokesperson Tony Snow said: "It was a free and fair election, and Turkey remains an important ally of the U.S."

EU Enlargement Commissioner Olli Rehn said the government must move forward on reforms as EU entry talks have stalled. "We expect the new government will be formed swiftly. It is essential that the new government will re-launch the legal and economic reforms with full determination and concrete results," he told reporters.

The Nationalist Movement Party (MHP), saw the greatest growth in support. Although in 2002, they pulled nearly 6% in support it was not enough for any seats. The 14.3% achieved in this election, got the MHP 71 seats. The general secretary of the party said it won't seek to create tensions.

The Republican People's Party (CHP) was dealt the biggest setback in the election. CHP saw an erosion in support that cost them 66 seats, leaving them with 112. 

"The only danger at the moment is failure to reach an accord over the presidency," said election observer and columnist for Hürriyet, Erdal Saglam.