The Vanuatu parliament has elected Seule Simeon as the new speaker just hours after Gracia Shadrack resigned from the position.
To stand as candidate for speaker, Mr Simeon resigned his education portfolio in the government led by Bob Loughman.
Mr Simeon was elected with 32 votes against 16 votes for the opposition's Ephraim Boereve.
Mr Shadrack had been locked in a dispute with the government after he last week declared 19 seats vacant, including the one held by the prime minister.
Mr Shadrack's resignation came amid the hearing of a constitutional challenge over the government motion seeking to remove him.
Lawyers of both sides agreed with the decision for him to resign.
On Friday, the court is to hear the motion challenging Mr Shadrack's ruling that the 19 seats had become vacant.
If the government challenge fails, the 19 MPs will lose their seats, and a new government will have to be formed and a new speaker will have to be chosen.