Mr Annan said time was running out for an agreement, and the bloodshed had to end. "I expect the Syrian parties to cooperate," he said. He hoped to bring the parties to the table and persuade them that the time for talking has come.
William Hague observed on Twitter: "A step forward in Geneva after tough talks: agreement to principles of transition in Syria. Only a start - need to follow up and implement."
At the start of the day the prospects for a successful meeting had seemed low. But although agreement between the powers has been acheived, there was little detail on how a national government could be formed. Mr Assad has shown little interest in talking to his opponents, and they have increasingly turned to to armed struggle in recent weeks.
Before the meeting Mr Annan had warned that the conflict could spread across the Middle East and beyond.
"We are here to agree on guidelines and principles for a Syrian-led political transition that meets the legitimate aspirations of the Syrian people," Mr Annan said in opening remarks. "No one should be in any doubt as to the extreme dangers posed by the conflict - to Syrians, to the region, and to the world."
His plan for a negotiated solution to the 16-month-old conflit was the only one on the table and its failure would doom Syria to even more violence. More than 10,000 people have been killed since the anti-Assad uprising broke out and the past few weeks have been among the bloodiest.
Moscow has objected to any solution imposed on Syria from outside. The United States and its European and Arab allies see no way ahead while power remains in Assad's hands.
As the talks were held, Syrian government forces were pushing their way into Douma on the outskirts of Damascus after weeks of siege and shelling. Fleeing residents spoke of corpses lying in the streets.
War planes reportedly struck targets in the suburb, and the army also attacked pro-opposition areas in Deir al-Zor, Homs, Idlib and the outskirts of Damascus, opposition activists said.
Mr Annan said the crisis should never have reached this point. "Either unite to secure your common interests or divide and surely fail in your own individual way. Without your unity, your common resolve and your action now ... nobody can win and everyone will lose in some way," he said.
British Foreign Secretary William Hague said before the meeting that Mr Assad and his close associates could not lead any transition. Accountability for war crimes must be part of such a process, he added in his speech to the meeting.
Mr Hague called for the UN Security Council to start drafting a resolution next week setting out sanctions against Syria, a move that he noted put him at at odds with Russia.
Chinese Foreign Minister Yang Jiechi told the talks the solution lay with the Syrian people, not outsiders, but that Beijing fully supported Mr Annan's mediation.
Iran, Syria's closest regional ally, and Saudi Arabia, a foe of both Damascus and Tehran and leading backer of the rebel forces opposing Assad, were not represented. Nor was anyone from the Syrian government or opposition.