State-of-the-art atomic clocks are based on the precise detection of the energy difference between two atomic levels, which is measured in terms of the quantum phase accumulated over a given time interval1,2,3,4. The stability of optical-lattice clocks (OLCs) is limited both by the interrupted interrogation of the atomic system by the local-oscillator laser (Dick noise5) and by the standard quantum limit (SQL) that arises from the quantum noise associated with discrete measurement outcomes. Although schemes for removing the Dick noise have been recently proposed and implemented4,6,7,8, performance beyond the SQL by engineering quantum correlations (entanglement) between atoms9,10,11,12,13,14,15,16,17,18,19,20 has been demonstrated only in proof-of-principle experiments with microwave clocks of limited stability. The generation of entanglement on an optical-clock transition and operation of an OLC beyond the SQL represent important goals in quantum metrology, but have not yet been demonstrated experimentally16. Here we report the creation of a many-atom entangled state on an OLC transition, and use it to demonstrate a Ramsey sequence with an Allan deviation below the SQL after subtraction of the local-oscillator noise. We achieve a metrological gain of decibels over the SQL by using an ensemble consisting of a few hundred ytterbium-171 atoms, corresponding to a reduction of the averaging time by a factor of 2.8 ± 0.3. Our results are currently limited by the phase noise of the local oscillator and Dick noise, but demonstrate the possible performance improvement in state-of-the-art OLCs1,2,3,4 through the use of entanglement. This will enable further advances in timekeeping precision and accuracy, with many scientific and technological applications, including precision tests of the fundamental laws of physics21,22,23, geodesy24,25,26 and gravitational-wave detection27.