In 1895 Cubans launched a War of Independence against Spain. Machado joined the rebel forces and rose to the rank of brigadier general. He was one of the youngest Cuban generals in the war. He fought in the middle provinces.