The initial-boundary value problem for the Korteweg-de Vries equation posed on a finite interval of the spatial variable is considered. Using the method of simultaneous spectral analysis of the associated Lax pair, this problem is mapped into a Riemann-Hilbert problem formulated in the complex plane of the spectral parameter, but with explicit dependence on the space-time variables appearing in the Korteweg-de Vries equation. It is shown that, under certain conditions, the solution of this Riemann-Hilbert is uniquely determined by certain functions of the spectral parameter, which are defined by the initial and boundary data of the original problem. In turn, the solution of the Riemann-Hilbert problem provides the solution of the initial-boundary value problem for the Korteweg-de Vries equation, for which an integral representation is derived. From the latter system, one immediately deduces that Y 0 ͑x͒, Ỹ 1 ͑x͒ ª iY 1 ͑x͒, Z 0 ͑x͒ ª iZ 0 ͑x͒, and Z 1 ͑x͒ are real-valued functions. Finally, using ͑2.37͒, one arrives at