The battery-powered nail gun has a motor that compresses the spring. When you press the trigger, the spring is released, and it creates pressure to drive the nail. It is as simple as that.