Kev, you possibly have a loose connection which is exacerbated by vibration. Run a separate wire directly from the battery
to the pos of the coil (assuming neg ground), make sure of all earths and see if that cures it. Any brief interruption of supply to the coil will cause a spark. If you have a spare known good coil, substitute it. Once the secondary is checked out (it's easier) then turn yor atention to the primary which is more machine-specific: Which bike, what type of ignition?
Machine speciallists may then get the bit between the teeth!