Spatial audio can be experienced through headphones as well as loudspeakers. When using headphones, spatial audio can be achieved via binaural audio, which uses head-related transfer functions (HRTFs) to simulate the way sound is naturally filtered by the head, ears, and torso before reaching the eardrum. This allows the listener to perceive the direction, distance, and movement of sound sources as if they were in a real 3D environment.
For loudspeakers, you need to employ a so-called decoder, which calculates the weights of each loudspeaker in the setup in order to reproduce a desired sound experience.