Gathered in the Saudi capital for the first major talks among various political and armed factions, representatives agreed on a framework for negotiations sought by world powers.
"The participants are ready to negotiate with representatives of the Syrian regime... within a specific timeframe that would be agreed on with the United Nations," participants said in a statement.
But the opposition groups insisted that "Bashar al-Assad and his aides quit power with the start of the transition period" set out by world powers in Vienna last month.
The United States swiftly welcomed the Riyadh accord.
"We welcome the positive outcome... including reaching a consensus on principles for a pluralistic and democratic Syria and on how to advance a political settlement," said US Secretary of State John Kerry.
"We appreciate Saudi Arabia’s leadership in convening this broad and representative group... who agreed today on the structure of their negotiating body to represent them," he said.
"While this important step forward brings us closer to starting negotiations between the Syrian parties, we recognise the difficult work ahead, and remain determined to continue toward a political settlement that brings an end the conflict."
However, one of Syria's most important rebel groups, the Ahrar al-Sham force, said it had walked out of the meeting.
But sources inside the talks and Western diplomats said it subsequently signed on to the agreement, though this could not immediately be confirmed.
In the biggest diplomatic push yet to resolve Syria's nearly five-year civil war, top diplomats from 17 countries -- including backers and opponents of Assad -- agreed in Vienna on a roadmap for the country.
It would see a transitional government set up within six months and elections held within 18 months, and calls for negotiations between the opposition and Assad's regime by January 1.
Under Thursday's deal, opposition groups have formed a "supreme committee for negotiations" based in Riyadh that will act as a reference for their negotiating team, whose members the body will choose.
- 'Unified vision' -
According to opposition sources, the committee will be made up of 30 members, a third of them representing armed factions.
Signup to our newsletter and follow us on Facebook and Twitter!
The opposition groups called on the United Nations and international community to force the regime to take "goodwill measures" before negotiations can begin. That would include an end to indiscriminate bombing and sieges on rebel-held areas, the entry of humanitarian aid, the release of political detainees and a halt to executions.
Suhair Atassi, a member of the National Coalition, the main political opposition grouping, told AFP the agreement represented "a unified vision for the settlement process".
The future of Assad was a key issue of the talks.
Western- and Arab-backed rebel groups have insisted the Syrian leader must step down immediately. Internal opposition groups disagree, as do Assad's key backers, Tehran and Moscow.
Participants appeared to have reached a compromise by agreeing to hold talks without Assad's immediate departure but insisting he step down later.
The opposition has been under intense pressure to sign up to the peace process.
- Assad must go: Saudi -
Not all of the armed factions attended the talks, with the Islamic State group and the Al-Qaeda affiliated Al-Nusra Front excluded.
Kurdish fighters were also left out.
At parallel talks in Syria this week the Syrian Democratic Forces, a Kurdish-Arab coalition fighting IS in northern Syria, announced the creation of a political wing called the Syrian Democratic Council.
Given its longstanding opposition to Assad, Saudi Arabia's hosting of the talks came under fire, with Tehran saying the meeting was in breach of declarations made in the international peace talks.
Iran's Deputy Foreign Minister Hossein Amir Abdollahian said groups linked to IS were attending.
"Terrorist groups pretending to be moderate opponents (of the regime) and seeking to determine the future of Syria and the region will not be permitted," Abdollahian said in remarks quoted by state television.
"Only the people of Syria can decide the future of their country," he added.
Riyadh has been among those calling most strongly for Assad's departure, and Saudi Foreign Minister Adel al-Jubeir insisted again Thursday that he must leave.
Assad "has two choices: leave through negotiations, which would be fastest and easiest, or he will be removed by force, because the Syrian people refuse for this man to be allowed to stay in power," Jubeir said.
The United States will hold further discussions on Syria with Russia and the United Nations in Geneva on Friday.
Since it began in March 2011, Syria's conflict has left more than 250,000 dead and forced millions from their homes.