The US military has successfully rescued an American hostage from armed men in the northern part of Nigeria.