Magnetic fields may have been generated in the electroweak phase trans
ition through spontaneous symmetry breaking or through the subsequent
dynamical evolution of semiclassical field configurations. Here I demo
nstrate explicitly how magnetic fields emerge spontaneously in the pha
se transition also when no gradients of the Higgs field are present. U
sing a simple model, I show that no magnetic fields an generated, at l
east initially, from classical two-bubble collisions in a first-order
phase transition. An improved gauge-invariant definition of the electr
omagnetic field is advocated which is more appropriate in the sense th
at it never allows electrically neutral fields to serve as sources for
the electromagnetic field. In particular, semiclassical configuration
s of the Z field alone do not generate magnetic fields. The possible g
eneration of magnetic fields in the decay of unstable Z strings is dis
cussed.