Rebels say they retook the city's eastern and western gates by dawn. People honked horns and fired guns in celebration amidst burned out tanks that litter the area.
Just a week ago, the uprising appeared to be on the verge of defeat. Ajdabiya's fall to Gadhafi's troops spurred the U.N. resolution authorizing international action to protect Libya's people.
Earlier Friday, British and French warplanes hit near Ajdabiya, destroying an artillery battery and armored vehicles. Ajdabiya, the gateway to the opposition's eastern stronghold, and the western city of Misrata have especially suffered because the rebels lack the heavy weapons to lift Gadhafi's siege.
So far, the U.S. has led the military campaign, but within days, NATO is expected to assume control of the no-fly zone and some responsibility for the air attacks.
The turnaround in Ajdabiya is a boost for President Barack Obama, who has faced complaints from lawmakers from both parties that he has not sought their input about the U.S. role in the war or explained with enough clarity about the U.S. goals and exit strategy. Obama was expected to give a speech to the nation Monday.
Obama says the military campaign in Libya is succeeding.
In his radio and TV address Saturday, the president said Libya's air defenses have been taken out and forces loyal to Gadhafi have been pushed back.
His comments come as pentagon officials say they're considering sending more firepower and airborne surveillance systems to find and attack enemy troops in Libya.
AC-130 gunships could unleash their firepower at night from low altitude. That would allow precision attacks against Libyan ground forces without risking civilian casualties.
The Associated Press contributed to this story.