After introducing a d=10 pure spinor $lambda^alpha$, the Virasoro constraint $partial x^m partial x_m =0$ can be replaced by the twistor-like constraint $partial x^m (gamma_m lambda)_alpha=0$. Quantizing this twistor-like constraint leads to the pure spinor formalism for the superstring where the fermionic superspace variables $theta^alpha$ and their conjugate momenta come from the ghosts and antighosts of the twistor-like constraint.