The rebels said shells rained down well after the announcement and accused Gadhafi of lying.
British and France took the lead in enforcing a no-fly zone, sending British warplanes to the Mediterranean and announcing a crisis summit in Paris with the U.N. and Arab allies.
Meantime, President Barack Obama ruled out the use of American ground troops but warned that the U.S., which has an array of naval and air forces in the region, would join in military action.
There should be no doubt about the Libyan leader's intentions "because he has made them clear," Obama said. "Just yesterday, speaking of the city of Benghazi, a city of roughly 700,000, he threatened `we will have no mercy and no pity.' No mercy on his own citizens."
In his Friday statement, Obama did not specify what responsibilities would fall to the United States if military action is carried out against Gadhafi, but officials have said previously that American forces would help enforce a no-fly zone to prevent the Libyan leader from using his air force to bomb civilians.
Instead, Obama listed a series of demands for Gadhafi, including the halting of all attacks against civilians, a stop to military action against Benghazi and other cities and permission for humanitarian supplies to reach the civilian population of the country.
"Let me be clear, these terms are not negotiable," he said.
In a statement to Gadhafi, the U.S., Britain, France and unspecified Arab countries said a cease-fire must begin immediately in Libya, according to the French presidential palace.
The statement called on Gadhafi to end his troops' advance toward Benghazi and pull them out of the cities of Misrata, Ajdabiya and Zawiya, and called for the restoration of water, electricity and gas services in all areas. It said Libyans must be able to receive humanitarian aid or the "international community will make him suffer the consequences" with military action.
Parts of eastern Libya, where the rebels this week found their hold slipping, erupted into celebration at the passage of the U.N. resolution. But the timing and consequences of any international military action remained unclear.
According to the rebels, the city of Misrata came under heavy assault well after the cease-fire announcement. A witness said Gadhafi's snipers were on rooftops and his forces were searching homes for rebels.
The rebels still hold eastern Libya, which has most of the country's oil reserves. Oil prices slid after the cease-fire announcement, plunging about $2.50 in the first 15 minutes of New York trading. They were down slightly for the week, settling at $101.07 per barrel on the New York Mercantile Exchange.
Rebel spokesman Mustafa Gheriani said the opposition is considering calling Gadhafi's bluff by holding new protests in Tripoli and elsewhere in Gadhafi-held areas to see if his forces open fire.
"The idea is that when he cannot bomb civilians, the whole world will see that Libya does not want him," Gheriani said. "I believe his troops in Tripoli will leave him. We want to make our revolution a peaceful one again, just surround his compound and make him leave."
Gheriani said that shelling continued late into Friday in the western mountain town of Zintan. However, even in advanced militaries, orders can take time to make it through the ranks, and it wasn't clear if all of Gadhafi's front-line troops had received the cease-fire directive by late Friday.
In Washington, Secretary of State Hillary Rodham Clinton said the immediate objective of any intervention was to halt violence against civilians, but insisted that the "final result of any negotiation would have to be the decision by Col. Gadhafi to leave."
The U.N. Security Council resolution, which passed late Thursday, set the stage for airstrikes, a no-fly zone and other military measures short of a ground invasion. Within 12 hours, Gadhafi's government announced "an immediate cease-fire and to stop all military operations," said Libyan Foreign Minister Moussa Koussa.
More than 300,000 people have fled Libya since fighting began, the U.N. said Friday, and the exodus shows no signs of slowing. The U.N. said between 1,500 and 2,400 people have been crossing the borders with Egypt and Tunisia each day.
The Associated Press contributed to this report.