In a video shown on Lebanese TV, the captive businessman was seen appealing for more information concerning the 1978 disappearance of the prominent Lebanese Shia cleric Musa al-Sadr.
He was freed in the city of Baalbek and dispatched to Beirut, police told AP.
The 40-year-old former playboy was given sanctuary in Oman in 2012.
His father Muammar was overthrown by rebels in a 2011 uprising.
Al-Sadr, one of the most prominent Shia clerics of the 20th Century, disappeared along with two others during a trip to Libya in 1978.
Muammar Gaddafi denied any involvement in his disappearance, but many suspect him of having orchestrated it.
The case has long soured relations between the two countries.
It is not known how long Hannibal has been in Lebanon.
He was under house arrest while in Oman with his sister Ayesha and mother Safiya.