A item becomes statically charged when it builds up an excess or deficit of electrons (potential) and cannot shed them.
The 'spark' happens when another object at a different potential comes in close enough proximity to allow a 'breakdown' of the insulative material (air) and there is a sudden equalizing of potential (flow of electrons) between the two objects. Its bad when that flow of electrons passes through a chip and burns out some transistor gates.
To be extra safe when working on computers you would connect the ground pin (or chassis) of your computer to a (slightly) conductive surface on which you place all of your electrostatic sensitive components. Every time you want to touch one of your components, touch the (slightly) conductive surface first or the chassis of your computer. This will safely equalize any charge, the high resistivity of the slightly conductive surface prevents damaging currents and bleeds them off safely.
Generally, the pink bubble wrap, or slightly silvery packages your motherboard and/or computer parts came in are good "slightly" conductive surfaces. Place case on ground, slightly overlapping the case cover. Place package on case cover, place components on package. Always touch case when two objects are about to touch. (You & component, component and computer)