To build a quantum computing device, which is capable of generating arbitrary input states and performing universal unitary gate operations (UUGOs), is an important goal in the field of quantum information science. However, only a few special quantum computations have been reported by now based on specific input states and well-designed information processors. Here, we demonstrate a flexible scheme for two-qubit quantum computations by employing the polarization and the spatial mode of a single photon. Two-qubit UUGOs both in free-space optics and for arbitrary pure input states consisting of separable states and entangled states are presented. Quantum state tomography and process tomography are used to characterize the fidelity of the output states and the gate operations we considered. Beyond a demonstration, we believe that our work also enriches the techniques of bulk-optics for quantum information study and has a broad application for other fundamental research.