We propose a method to measure the quantum state of a single mode of the electromagnetic field. The method is based on the interaction of the field with a probe qubit. The qubit polarizations along coordinate axes are functions of the interaction time and from their Fourier transform we can in general fully reconstruct pure states of the field and obtain partial information in the case of mixed states. The method is illustrated by several examples, including the superposition of Fock states, coherent states, and exotic states generated by the dynamical Casimir effect.