Quantum information science addresses how the storage, processing, and transmission of information are affected by uniquely quantum mechanical phenomena, such as superposition and entanglement. New technologies that harness these quantum effects are beginning to be realized in the areas of communication, information processing and precision measurement. For the realization of a universal gate set, by which, in principle, any quantum information task can be realized, two-qubit gates have been demonstrated and have been used to realize small-scale quantum circuits. However, scalability is becoming a critical problem. It may therefore be helpful to consider the use of three-qubit gates, which can simplify the structure of quantum circuits dramatically. Although both the controlled-SWAP (CSWAP) gate (also called Fredkin gate) and the controlled-controlled-NOT gate (also called Toffoli gate) are representative three-qubit gates, the Fredkin gates can be directly applied to many important quantum information protocols, e.g., error correction, fingerprinting, optimal cloning, and controlled entanglement filtering. Here we report a realization of the Fredkin gate using a photonic quantum circuit, following the theoretical proposal by Fiurasek. We achieve a fidelity of 0.85 for the classical truth table of CSWAP operation and an output state fidelity of 0.81 for a generated 3-photon Greenberger-Horne-Zeilinger (GHZ) state. We also confirmed that the gate is capable of genuine tripartite entanglement with a quantum coherence corresponding to a visibility of 0.69 for three-photon interferences. From these results, we estimate a process fidelity of 0.77, which indicates that our Fredkin gate can be applied to various quantum tasks.