  We study the observational signature of flux emergence in the photosphere
using synthetic data from a 3D MHD simulation of the emergence of a twisted
flux tube. Several stages in the emergence process are considered. At every
stage we compute synthetic Stokes spectra of the two iron lines Fe I 6301.5
{\AA} and Fe I 6302.5 {\AA} and degrade the data to the spatial and spectral
resolution of Hinode's SOT/SP. Then, following observational practice, we apply
Milne-Eddington-type inversions to the synthetic spectra in order to retrieve
various atmospheric parameters and compare the results with recent Hinode
observations. During the emergence sequence, the spectral lines sample
different parts of the rising flux tube, revealing its twisted structure. The
horizontal component of the magnetic field retrieved from the simulations is
close to the observed values. The flattening of the flux tube in the
photosphere is caused by radiative cooling, which slows down the ascent of the
tube to the upper solar atmosphere. Consistent with the observations, the
rising magnetized plasma produces a blue shift of the spectral lines during a
large part of the emergence sequence.

Solar and Stellar Astrophysics