Spatial locality refers to the tendency of a program to access data locations that are close to each other within a short time period. This principle is leveraged in computer systems to optimize performance by loading data into cache lines that contain not just the requested data, but also adjacent data likely to be used soon.