  We study spatial spin and density self-ordering of a two-component
Bose-Einstein condensate via collective Raman scattering into a linear cavity
mode. The onset of the Dicke superradiance phase transition is marked by a
simultaneous appearance of a crystalline density order and a spin-wave order.
The latter spontaneously breaks the discrete $\mathbf{Z}_2$ symmetry between
even and odd sites of the cavity optical potential. Moreover, in the
superradiant state the continuous $U(1)$ symmetry of the relative phase of the
two condensate wavefunctions is explicitly broken by the cavity-induced
position-dependent Raman coupling with a zero spatial average. Thus, the
spatially-averaged relative condensate phase is locked at either $\pi/2$ or
$-\pi/2$. This continuous symmetry breaking and relative condensate phase
locking by a zero-average Raman field can be considered as a generic
order-by-disorder process similar to the random-field-induced order in the
two-dimensional classical ferromagnetic $XY$ spin model. However, the seed of
the random field in our model stems from quantum fluctuations in the cavity
field and is a dynamical entity affected by self-ordering. The spectra of
elementary excitations exhibit the typical mode softening at the superradiance
threshold.
