The retreat comes hours after the United Nations Security Council passed a resolution backing all necessary measures to stop Gaddafi troops from attacking opposition fighters.
Foreign Minister Mussa Kussa said the Libyan government will offer humanitarian aid and respect human rights.
“Libya has decided an immediate ceasefire and an immediate halt to all military operations,” Kussa said.
Gaddafi’s regime also retreated from its harsh position against opposition fighters and said it respects the UN resolution.
A number of Western countries are preparing to launch air strikes against Libya.
The United States, Britain, France, Spain and many other European countries say they are ready to take part in any military action against Libya.
A French government spokesman, earlier, said military action against Libya will come within hours.
Spain also said it would provide air and naval forces in possible military operations against Libya.
Libyan revolutionary fighters have taken to the streets of Benghazi and some other cities to express their joy at the passing of the resolution.
However, Libyan dictator Gaddafi says foreign forces will receive an overly strict response, should they invade the North African country.
“If the world goes crazy, so will we!” Gaddafi said on Friday. “We will respond. We will turn their lives into hell.”