A capacitor stores electrical energy and releases it when needed to assist in various circuit functions, such as filtering or smoothing out voltage.