In New York, the 15-member body voted 10-0 in favour, with five abstentions.
Earlier reports suggested that if the resolution were passed, air attacks on Col Gaddafi's forces by the British and French air forces could begin within hours.
It is not thought that the US would be involved in the first strikes, but the British and French are likely to get logistical backup from Arab allies.
Russia and China, which often oppose the use of force against a sovereign country as they believe it sets a dangerous precedent, abstained rather than using their power of veto as permanent members.
But Germany, which abstained, will not be contributing to the military effort. Foreign Minister Guido Westerwelle said his government sees "considerable dangers and risks" in military action against Col Gaddafi.
Earlier on March 17, addressing the people of Benghazi, Col Gaddafi said his troops were coming "tonight" and there will be "no mercy".
He told rebels to go home, adding that "whoever lays down his weapons" will be pardoned.
Rebel leaders replied by saying their forces will stand firm and not be deterred by Col Gaddafi's threats.
Shortly before the UN vote, anti-aircraft fire and explosions were heard in Benghazi.
Add new comment