Many practical applications require the knowledge of the equation of state of fluids in restricted geometry. We study a hard-sphere fluid at equilibrium in a narrow cylindrical pore with hard walls for pore radii R<(√3 +2)/4 (in units of the hard sphere diameter). In this case each particle can interact only with its nearest neighbors, which makes possible the use of analytical methods to study the thermodynamics of the system. Using a transfer operator formalism and expanding in low- and high-pressure regions, we can obtain a simple analytical equation of state for almost all ranges of pressure. The results agree with Monte Carlo simulations. Additionally, it is shown that a convenient analytical representation can be chosen to accurately describe the equation of state within the error of the Monte Carlo simulation.