The Union Army fought and defeated the Confederate States Army during the war , from 1861 to 1865 . The Union Army fought and eventually defeated the smaller Confederate States Army during the war which lasted from 1861 to 1865 .