Spokesperson Ayoub Gassim told the Associated Press news agency that a rubber boat carrying 38 people, most of them Egyptians, was stopped on Tuesday 65km northeast of the capital Tripoli.
He added that the migrants were transferred to the Tajoura detention centre.
Two air attacks on the facility earlier in July had killed at least 60 people and caused an international outcry with rights groups demanding the centres be closed.
The attack followed repeated warnings about the ill-treatment of the mainly African migrants who transit through the turbulent North African country as well as the vulnerability of migrants in such guardhouses.
The United Nations condemned the attack – widely blamed on the air force of renegade military commander Khalifa Haftar – on the compound at the time, saying it had provided the location’s exact coordinates to the two parties fighting in the country.
Libya has had two rival governments over the last few years.
The UN-recognised administration, led by Prime Minister Fayez al-Sarraj, is based in Tripoli, and is supported by Turkey as well as most Western nations.
In the east, there is the Tobruk-based government, the centre of power for Haftar, who is backed by Egypt, Saudi Arabia and the United Arab Emirates (UAE).
Haftar and his backers say they are trying to free Tripoli from armed groups they accuse of destabilising Libya since the fall of Muammar Gaddafi in a NATO-backed uprising in 2011.