"They are out," UN spokesman Manoel de Almeida e Silva said on Tuesday.
Armed men seized Philippine diplomat Angelito Nayan, British-Irish citizen Annetta Flanigan and Shqipe Hebibi of Kosovo in Kabul on 28 October, the first such abduction in the Afghan capital since the Taliban fell three years ago.
Officials said on Tuesday the three were freed overnight and were in Kabul. One Western official said doctors were examining the trio at a Nato field hospital.
News of the release came hours after US and Afghan forces raided two houses in downtown Kabul on Monday and detained 10 people in connection with the abductions.
Most of the detainees were released after being questioned, an Afghan intelligence official said, and it was not clear if the arrest of a doctor who worked at a UN clinic in the city had hastened the hostages' release.
Afghan officials believe a criminal gang carried out the abductions and that negotiations centred on a ransom demand.
But it remains unclear if the kidnappers were working for a Taliban-linked group that had claimed responsibility and demanded that Afghan and US authorities free jailed comrades.
The leader of the group, which called itself Jaish-al Muslimin, or Army of Muslims, said on Monday the captors were "very close to an understanding" with government negotiators to exchange the hostages for 24 detainees in Afghan jails.
His claims could not be verified.
UN spokesman Almeida e Silva declined to elaborate on how the three were released, saying the Afghan interior minister would provide details at a news conference later on Tuesday.