The vote in the 15-member council was 10-0 with five abstentions, including Russia and China.
The United States, France and Britain pushed for speedy approval because the Libyan leader is vowing an all-out assault on the rebel stronghold of Benghazi.
French Prime Minister Francois Fillon said if the resolution was approved, France would support military action against Gadhafi within hours. The U.S. said it was preparing for action. Several Arab nations were expected to provide backup.
The U.S. and its allies could begin bombing in Libya within hours. This after the United Nations Security Council passed a resolution authorizing a no-fly zone and military action to protect civilians.
Residents in the threatened rebel stronghold of Benghazi said they felt betrayed by the international community. But Thursday night with the latest news, it looked like New Year's Eve.
Moammar Gadhafi's forces, armed with heavy weapons, have been steadily moving east, retaking towns captured by the rebels, unleashing a punishing air and ground assault.
Now they are poised at Ajdabiya, ready for the final push to retake Benghazi and bring an end to the uprising.
In a radio address, Gadhafi told the people of Benghazi his forces would be there within hours, bringing vengeance to those who do not lay down their weapons.
After the Security Council vote, a Libyan diplomat who has disowned his own government, called for quick action before time runs out.
"The lives of the civilians are in danger right now, and I expect the international community to move quickly," said Libya's Deputy U.N. Ambassador Ibrahim Dabbashi.
Thursday, U.S. Secretary of State Hillary Clinton confirmed that bombing would be part of any no-fly zone to protect the pilots.
Air and sea strikes have also been authorized to protect Libyans in Benghazi and other areas under threat of attack.
The resolution does not allow foreign ground troops to enter Libya.
Gadhafi remains defiant.
"Let the whole world launch war against us. Bomb us even with atomic bombs. We will never give up," said Gadhafi.
The U.N. resolution also calls for the interception of ships carrying supplies to Gadhafi's government.
Air strikes could be carried out by the U.S., Britain, France and possibly a few Mideast allies.
The first likely targets are defense installations and runways.
It's not clear whether Gadhafi's ground forces heading for Benghazi will also be targeted.
The Associated Press contributed to this report.