Individually trapped Rydberg atoms show significant promise as a platform for scalable quantum simulation and for development of programmable quantum computers. In particular, the Rydberg blockade effect can be used to facilitate both fast qubit-qubit interactions and long coherence times via low-lying electronic states encoding the physical qubits. To bring existing Rydberg-atom-based platforms a step closer to fault-tolerant quantum computation, we demonstrate high-fidelity state and circuit preparation in a system of five atoms. We specifically show that quantum control can be used to reliably generate fully connected cluster states and to simulate the error-correction encoding circuit based on the 'Perfect Quantum Error Correcting Code' by Laflamme et al. [Phys. Rev. Lett. 77, 198 (1996)]. Our results make these ideas and their implementation directly accessible to experiments and demonstrate a promising level of noise tolerance with respect to experimental errors. With this approach, we motivate the application of quantum control in small subsystems in combination with the standard gate-based quantum circuits for direct and high-fidelity implementation of few-qubit modules.