The leaders of Russia, Ukraine, Germany and France announced that a ceasefire would begin on 15 February.
The deal also includes weapon withdrawals and prisoner exchanges, but key issues remain to be settled.
The pro-Russian rebels in eastern Ukraine have signed the agreement. Thousands of people have died in almost a year of fighting in the region.
The BBC’s Richard Galpin in Minsk says the deal is very similar to a ceasefire agreed last September, which unravelled very quickly.
Ceasefire to begin at 00:01 local time on 15 February
Heavy weapons to be withdrawn, beginning on 16 February and completed in two weeks
All prisoners to be released; amnesty for those involved in fighting
Withdrawal of all foreign troops and weapons from Ukrainian territory. Disarmament of all illegal groups
Ukraine to allow resumption of normal life in rebel areas, by lifting restrictions
Constitutional reform to enable decentralisation for rebel regions by the end of 2015
Ukraine to control border with Russia if conditions met by the end of 2015
Key unresolved issues include the status of Debaltseve, a government-held town surrounded by rebels, where fighting is still going on.
Further talks will also be held on self-rule in parts of Donetsk and Luhansk separatist regions.
French President Francois Hollande said he and German Chancellor Angela Merkel would ask their European Union partners to support the deal at a summit in Brussels on Thursday.
Ms Merkel said there was now a “glimmer of hope” but big hurdles remained, while Mr Hollande said “the coming hours will be decisive”.
If the Minsk ceasefire failed last September, then how is this different and could it work?
For the rebels, the new ceasefire line is the same as the old one, so they lose some of the territory they have gained. But government forces must pull back from the current front line, and territory they have lost since January is confirmed as lost.
It separates the two sides but in some areas not by much, and again it falls on international monitors to observe the truce.
The real sticking point here is what happens to Debaltseve, where government forces are still under siege.
The only real buffer zone is for heavy weapons, with a minimum of 50km (30 miles) between rival forces’ artillery (140km for rockets). France’s President Hollande had proposed a demilitarised zone, but this is not it.
If the truce holds, then Ukraine gets its eastern border back. But only after elections in Donetsk and Luhansk held under Ukrainian law, and only after a comprehensive deal on reform and decentralisation.
There is a great deal that can go wrong before that.
EU foreign policy chief Federica Mogherini said European leaders in Brussels would be discussing ways to “help and sustain the agreement”, but she ruled out the threat of fresh sanctions on Russia.
“I think today the issue is not going to be discussion of further sanctions… but rather positive ways the EU can contribute to make this first step just one of many others,” she told reporters in Brussels.
The US said the deal was a “significant step” but expressed concern over reports of continued fighting in eastern Ukraine, saying it was “inconsistent with the spirit of the accord”.
Last week, the US refused to rule out supplying “lethal defensive weapons” to Ukraine if diplomacy failed, but Russia says that would worsen the crisis.
Speaking after the talks ended, Mr Putin told Russian television: “It wasn’t the best night for me, but it’s a good morning.”
Mr Poroshenko – who had accused Russia of making “unacceptable” demands – said that “despite tension and pressure” Ukraine had not succumbed to “ultimatums”.
Russia rejects accusations by Ukraine and Western powers that it is supplying weapons and personnel to the rebels – who are seeking independence for the areas they control.
The separatists gave the agreement a cautious welcome.
In Luhansk, rebel leader Igor Plotnitskiy said: “We hope that thanks to our efforts today, Ukraine will change and stop firing at civilians, hospitals and socially important facilities.”
But Donetsk separatist leader Alexander Zakharchenko said Kiev would be to blame if the ceasefire collapsed and warned that there would “be no meetings and no new agreements”.
More than 5,400 people have been killed since the conflict began. There has been a dramatic rise in casualties in recent days, with 263 civilians killed in populated areas between 31 January and 5 February.
The BBC’s James Reynolds in rebel-held Donetsk says he heard explosions there after the agreement was signed, although he said they were not as regular as in recent days.
Overnight, Ukrainian military officials said 50 Russian tanks, as well as armoured vehicles and rocket launchers, had crossed into Ukraine on Thursday.