When you create a spark you generate a voltage, $V$, between the two electrodes and a current, $I$, flows between them. Both the voltage and the current vary with time, so we need to write them as functions of time: $V(t)$ and $I(t)$.
If we have a current $I$ flowing across a voltage $V$, then the power is given by:
$$ W = VI $$
Energy is power multiplied by time. So if we take a very short time $dt$ the energy in that time is:
$$ dE = VIdt $$
Now, in our system (the spark) both the voltage and current are functions of time, so to calculate the total energy we need to integrate $VIdt$:
$$ E = \int V(t) I(t) dt $$
And that's how we calculate the total energy in the spark.
Whether this answers your question or not I don't know, because I haven't actually calculated the energy. That's because I don't know how the voltage and current vary with time. How $V(t)$ and $I(t)$ vary with time will depend on the exact details of the spark. Obviously a gas lighter is going to be very different to a lightning bolt. There isn't an general rule to say how the voltageand current will vary with time so I can't provide a general answer. To actually calculate the energy in a spark would require detailed knowledge about the specific system you were considering.