An ion (hydrogen ions, H⁺) gradient has potential energy which can be used for making ATP. Because of the proton gradient, H⁺ will diffuse from an area with higher proton concentration to an area with lower proton concentration. ATP synthase is the enzyme which allows protons to pass through the membrane and uses the free energy difference to convert ADP into ATP.
The proton gradient is made by electron transport chain which pumps H⁺.