The primary function of spindle fibers is to ensure accurate chromosome segregation. They attach to the kinetochores on chromosomes and exert forces that pull sister chromatids apart, ensuring that each daughter cell receives an identical set of chromosomes.