Segmentation of the lungs in chest-computed tomography (CT) is often performed as a preprocessing step in lung imaging. This task is complicated especially in presence of disease. This paper presents a lung segmentation algorithm called adaptive border marching (ABM). Its novelty lies in the fact that it smoothes the lung border in a geometric way and can be used to reliably include juxtapleural nodules while minimizing oversegmentation of adjacent regions such as the abdomen and mediastinum. Our experiments using 20 datasets demonstrate that this computational geometry algorithm can re-include all juxtapleural nodules and achieve an average oversegmentation ratio of 0.43% and an average under-segmentation ratio of 1.63% relative to an expert determined reference standard. The segmentation time of a typical case is under 1min on a typical PC. As compared to other available methods, ABM is more robust, more efficient and more straightforward to implement, and once the chest CT images are input, there is no further interaction needed from users. The clinical impact of this method is in potentially avoiding false negative CAD findings due to juxtapleural nodules and improving volumetry and doubling time accuracy.