MARIB - A UN-brokered ceasefire was taking hold in Yemen on Monday despite sporadic clashes, raising hopes that peace talks due next week may finally resolve the country's devastating conflict.

Forces loyal to President Abedrabbo Mansour Hadi, the Shiite Huthi rebels who drove his government out of the capital, and the Saudi-led coalition that intervened in Yemen last year all pledged to honour the truce after it took effect at midnight on Sunday.

The UN special envoy for Yemen, Ismail Ould Cheikh Ahmed, called the ceasefire "a first step in Yemen's return to peace".

"This is critical, urgent and much needed. Yemen cannot afford the loss of more lives," the Mauritanian diplomat said.

Previous efforts to stop the fighting in Yemen - which has left thousands dead and forced more than two million people from their homes - have collapsed amid mutual recriminations.

The conflict in the impoverished Arabian Peninsula nation has ruined large parts of the country and raised Middle East tensions, with Saudi Arabia and its Sunni allies backing the government and Shiite powerhouse Iran supporting the rebels.

Militants including from Al-Qaeda in the Arabian Peninsula (AQAP), the powerful Yemeni branch of the extremist network, have taken advantage of the conflict to seize territory and gain influence.

But pressure has been building for the ceasefire and there are hopes it can be the cornerstone of a long-lasting peace deal that can be hammered out at talks taking place from April 18 in Kuwait.

General Mohamed Ali al-Makdashi, the chief of staff for Hadi's forces, said early Monday the ceasefire was largely holding despite some violations by rebels.

"The truce has not collapsed and we hope the rebels end their attacks and respect the ceasefire," he said, alleging breaches in several areas including the cities of Taez in southwestern Yemen and Marib east of Sanaa.

Loyalists accused Huthis of 25 truce violations around Taez, where one civilian was killed in rebel bombing.

The rebels, meanwhile, said in a statement there was at least one coalition air strike in Taez province, and accused loyalists of being behind 33 truce violations north and east of Sanaa, as well as in the south.

A committee comprised of representatives from both sides will work to ensure the ceasefire is respected.

Coalition spokesman Brigadier General Ahmed Assiri earlier described the violations as "minor". "It is the first day and we should be patient," the top Saudi officer told AFP. "Day by day, it will be better."

An AFP photographer in Sanaa said the rebel-held capital has not been targeted by coalition warplanes since Sunday.

Prime Minister Ahmed bin Dagher also played down violations, saying that the truce "seems good", adding after meeting the UN envoy in Riyadh that "we want a durable peace". "Now is the time to step back from the brink," the UN's Cheikh Ahmed said. "The progress made represents a real opportunity to rebuild a country that has suffered far too much violence for far too long."

The Huthis, allied with troops loyal to ex-president Ali Abdullah Saleh, also committed to the ceasefire in a letter sent to the United Nations, according to a statement carried by the rebel-run Saba news agency.

The Huthis, a northern minority that has long complained of marginalisation, descended on the capital Sanaa from their mountainous region in September 2014, seizing the city with little resistance.

As they advanced into other areas, Hadi and other officials fled first to the main southern city of Aden and eventually to Riyadh.

Saudi Arabia and a coalition of mainly Sunni Arab allies launched air strikes in March last year against the Huthis and later sent ground troops to support pro-government forces.

The loyalists have since managed to reclaim large parts of the south, establishing a temporary capital in Aden, but have failed to dislodge the Huthis from Sanaa and other key areas.

The coalition has come under fire from rights groups, which allege its air war has caused heavy civilian casualties in Yemen.

The United Nations says more than 6,300 people have been killed in Yemen since March last year, around half of them civilians.

Analysts said the ceasefire is part of the most promising attempt yet to end the conflict.

"For the first time, the groups that can end major military operations, particularly the Saudis and the Huthis, appear to be more willing to do so," said April Longley Alley, a Yemen specialist at International Crisis Group. "Even if major combat ends, the road to peace in Yemen will be long and difficult and internal conflict is likely to continue for some time."