Libya's parliament has dismissed PM Ali Zeidan after a tanker laden with oil from a rebel-held port reportedly broke through a naval blockade.
MPs called a vote of confidence in Mr Zeidan after they were told the North Korean-flagged ship had escaped to sea.
Defence Minister Abdullah al-Thinni was named interim prime minister.
Earlier, Libyan officials had said they had "complete control" of the tanker as it tried to leave the port of Sidra. But the rebels rejected the assertion.
Separatist militants have occupied three major eastern ports since August.
They are seeking a greater share of the country's oil revenues, as well as autonomy for the historic eastern region of Cyrenaica.
The tanker - named Morning Glory - was reported to have taken on at least 234,000 barrels of crude at Sidra's oil terminal.
It was the first vessel to have loaded oil from a rebel-held port since the separatist revolt against the central government in Tripoli erupted in July.
The government is still struggling to assert its authority over the armed groups and tribesmen who helped topple Muammar Gaddafi in 2011.
The BBC's Rana Jawad in Tripoli says Mr Zeidan's removal is likely to raise more concerns over the stability of Libya as it struggles to maintain control over large parts of the country.
Members of Libya's parliament, the General National Congress, said that bad weather had stopped the navy's ships from following the tanker into the Mediterranean from Sidra.
Abdelkader Houili, a member of the GNC's energy committee, told al-Nabaa TV that the navy vessels had been forced to sail close to the coast.
"The tanker then took advantage of the gap to head for the open sea," he said.
Analysts say it is unlikely the ship is owned or controlled by North Korea and it is probably sailing under a flag of convenience to keep its true ownership secret.
On Monday, the GNC ordered a special force to be deployed to "liberate" all rebel-held oil terminals. The operation is due to start within one week.
Libya's government has tried to curb protests at oil fields and ports, which have seen vital oil revenues plummet.
However, there has been little progress at the indirect talks between officials and Ibrahim Jathran, a former anti-Gaddafi militia leader and regional head of the Petroleum Facilities Guard who is now leading the protests.
His demands include the formation of an independent commission representing the three historic regions of Libya, which will supervise the sale of oil and ensure the country's east gets a greater share of revenues.
Libya's oil output has slowed to a trickle since the protests started in July last year, depriving the Opec producer of its main budget source.