The Yemeni government and Shia Houthi rebels have signed an agreement aimed at ending the political crisis which has gripped the country for weeks.
Under the deal, a new government will be formed and the Houthis and southern separatists will nominate a new prime minister within three days.
It comes hours after the prime minister quit amid clashes between rebels and pro-government forces in the capital.
Scores of people have died and hundreds fled as clashes escalated in Sanaa.
On Sunday, the rebels said they had taken over government headquarters, key ministries and state broadcasters.
As the fighting intensified, Mohammed Basindwa said he would resign in order to clear the way for the agreement between the rebels and President Abdrabbuh Mansour Hadi.
The BBC’s Mai Noman in Sanaa says the formation of a new national unity government under a new prime minister was one of the Houthi movement’s demands.
A statement on the Yemeni interior ministry’s website urged the security forces to avoid confrontation with the rebels, describing them as “friends of the police”.
Houthi spokesman Mohamed Abdulsalam also suggested that the rebels were aligned with elements within the security forces.
“The military and security apparatus have supported the popular revolt,” Mr Abdulsalam said on his Facebook page.
The latest clashes were centred on a military base in Sanaa and the Iman university complex, both seen as strongholds of Sunni Islamist fighters and supporters of the Islah opposition party.
President Hadi had earlier described the rebel offensive as a “coup attempt”.
But later on Sunday, he attended a ceremony in Sanaa where Houthi rebels signed the deal, which had been brokered by UN envoy Jamal Benomar.
The deal called on the Houthis to hand over all military and government buildings they had seized in the capital but it is unclear whether the rebels are respecting this aspect of the accord.
Yemen has remained unstable since anti-government protests in 2011 forced the then-President Ali Abdallah Saleh from office. Mr Basindwa became PM in the government that succeeded Mr Saleh.
Based in Yemen’s mountainous north, the Houthis have been advancing on the capital for weeks, clashing with rivals and organising mass protests calling for greater rights.
The Houthi rebels, who belong to the minority Zaidi Shia community, have staged periodic uprisings since 2004 to win greater autonomy for their northern heartland of Saada province.
They consolidated control over Saada during the 2011 uprising and since July have inflicted defeats on tribal and militia groups backed by Islah, in neighbouring Amran province.
More recently they have demanded the president reverse a decision to cut fuel subsidies, which President Hadi agreed to do as part of Sunday’s deal.