Russian-backed Mr Yanukovich - under pressure to quit after mass demonstrations in Kiev - earlier offered a series of concessions to his pro-European opponents, including a national unity government and constitutional change to reduce his powers, as well as the presidential vote.
German Foreign Minister Frank-Walter Steinmeier said the deal provided for the creation of a national unity government and an early presidential election this year, although no date had been set. The vote had been due in March 2015.
During a signing ceremony lasting several minutes at the presidential headquarters, Mr Yanukovich did not smile.
Later the parliament voted to allow the release of former Prime Minister Yulia Tymoshenko after more than two years in prison.
One of the EU mediators, Polish Foreign Minister Radoslaw Sikorski, described the agreement as a "good compromise for Ukraine", adding: "It gives peace a chance. Opens the way for reform and to Europe."
At least 77 people have been killed this week in the worst violence since the independent country emerged from the wreckage of the Soviet Union in 1991.
Mr Yanukovich said: "There are no steps we should not take to restore peace in Ukraine."
The president said Ukraine would revert to a previous constitution under which parliament had greater control over the make-up of the government, including the prime minister.
He added: "I call for the start of procedures for forming a government of national unity."
Earlier, a Polish foreign ministry spokesman said a council of protesters occupying Kiev's Independence Square had backed the agreement.
The German and Polish foreign ministers travelled to Kiev to promote the political compromise to end the bloodshed amid a stand-off between riot police and anti-government protesters who have occupied the central square for nearly three months.
Before the deal was signed, armed police briefly entered the parliament building while lawmakers were holding an emergency session but they were quickly ejected, opposition leader Arseny Yatsenyuk said.
Members had exchanged punches when speaker Volodymyr Rybak had tried to adjourn proceedings.
Opposition deputies were angered because an adjournment would mean delaying a possible vote on a resolution pressing for constitutional changes to restrict the president's powers.
The speaker left the chamber and debate continued.
A deal is a setback for Russian President Vladimir Putin, who has made tying Ukraine into a Moscow-led Eurasian Union a cornerstone of his efforts to reunite as much as possible of the former Soviet Union.
Mr Putin appointed his own envoy to the talks at Mr Yanukovich's request on Thursday but it was not clear what role, if any, Russian officials had in the negotiations.
In another sign of the severity of the crisis, ratings agency Standard & Poor's yesterday cut Ukraine's credit rating for the second time in three weeks, citing the increased risk of default.
S&P said latest developments in the crisis made it less likely Ukraine would receive desperately needed Russian aid.
Ukraine has cancelled a planned issue of five-year Eurobonds worth £1.2 billion, it told the Irish Stock Exchange where the debt would have been listed.
Kiev had hoped Russia would buy the bonds to help it stave off bankruptcy. Russia's economy minister said Moscow was still undecided on the next £1.2 billion instalment of its £12bn loan agreed with Ukraine and was awaiting clarity on the government in Kiev.
On the financial markets, Ukraine's dollar bonds and the hryvnia currency firmed against the dollar yesterday from record lows hit this week on hopes for a deal.
However, RBS analyst Tatyana Orlova noted the country was still in dire financial straits. She said: "This is not the end of the story. What I am reading is there is a deal but the devil is in the detail. The urgent need is for a technocratic cabinet that could take steps to avert default."
The health ministry said 77 people had been killed since Tuesday afternoon which meant at least 47 died in Thursday's clashes.