State-of-the-art atomic clocks are based on the precise detection of the energy difference between two atomic levels, measured as a quantum phase accumulated in a given time interval. Optical-lattice clocks (OLCs) now operate at or near the standard quantum limit (SQL) that arises from the quantum noise associated with discrete measurement outcomes. While performance beyond the SQL has been achieved in microwave clocks and other atomic sensors by engineering quantum correlations (entanglement) between the atoms, the generation of entanglement on an optical-clock transition and operation of such a clock beyond the SQL represent major goals in quantum metrology that have never been demonstrated. Here we report creation of a many-atom entangled state on an optical transition, and demonstrate an OLC with an Allan deviation below the SQL. We report a metrological gain of $4.4^{+0.6}_{-0.4}$ dB over the SQL using an ensemble consisting of a few hundred 171Yb atoms, allowing us to reach a given stability $2.8{pm}0.3$ times faster than the same clock operated at the SQL. Our results should be readily applicable to other systems, thus enabling further advances in timekeeping precision and accuracy. Entanglement-enhanced OLCs will have many scientific and technological applications, including precision tests of the fundamental laws of physics, geodesy, or gravitational wave detection.