Libya's General National Congress has passed a no-confidence motion against Prime Minister Ali Zeidan and designated the defence minister as acting prime minister.
Parliamentarians voted to oust Zeidan as anger grew with the government's failure to stop eastern rebels from independently exporting oil.
The no-confidence motion was approved by 124 of the 194 members of the parliament, four more than the majority required, MPs said.
The vote on Tuesday came hours after an oil tanker carrying rebel oil escaped warships and left the country.
MP Suleiman al-Zubi told the AFP news agency that Defence Minister Abdullah al-Thinni was named interim premier for the two weeks the assembly now has to agree on a permanent replacement.
Parliament will support Thinni and not obstruct his work, its head Nuri Ali Abu Sahmain told the assembly during a session broadcast by state television after the caretaker prime minister took his oath.
Libya's top prosecutor has placed a travel ban on Zeidan because of his suspected involvement in the embezzlement of public funds, according to a document published on his office's Facebook page.
Previous attempts to bring down Zeidan had failed to win the required majority of 120 of the assembly's 194 members.
Zeidan's government had been repeatedly criticised for its failure to disarm militias which have carved out their own fiefdoms since the NATO-backed uprising that ended the 42-year rule of Muammar Gaddafi in 2011.
The prime minister was himself briefly abducted by an armed group in the heart of the capital, Tripoli, last October.
Rebels demanding a bigger share of oil revenue and political autonomy in the east seized three ports last summer and partly control a fourth.
The central government had threatened armed action, even an air strike, to prevent the North Korean-flagged tanker, which docked in al-Sidra port on Saturday, from getting away with its cargo.
The vessel was reported to have taken on at least 234,000 barrels of crude. It was intercepted by the navy on Monday, but managed to slip into international waters a day later.
Libya's navy opened fire on the tanker and Italian vessels were helping to secure the now-stationary vessel on Tuesday, a military spokesman said.
The ship had sailed further east from al-Sidra port before being attacked, Walid al-Tarhouni, spokesman for Libya's oil security force, told al-Nabaa television. He said the ship had initially escaped in bad weather.
There were unconfirmed reports that the ship was on fire after being hit by a missile.
Zeidan was elected in 2012 as the first prime minister after the overthrow and slaying of Gaddafi.
He has had the backing of the liberal-leaning National Forces Alliance against a bloc led by the Muslim Brotherhood, although parliament is divided as much on regional lines as ideological ones.