Close-in giant exoplanets with temperatures greater than 2,000 K ('ultra-hot Jupiters') have been the subject of extensive efforts to determine their atmospheric properties using thermal emission measurements from the Hubble Space Telescope (HST) and Spitzer Space Telescope(1-3). However, previous studies have yielded inconsistent results because the small sizes of the spectral features and the limited information content of the data resulted in high sensitivity to the varying assumptions made in the treatment of instrument systematics and the atmospheric retrieval analysis(3-12). Here we present a dayside thermal emission spectrum of the ultra-hot Jupiter WASP-18b obtained with the NIRISS13 instrument on the JWST. The data span 0.85 to 2.85 mu m in wavelength at an average resolving power of 400 and exhibit minimal systematics. The spectrum shows three water emission features (at >6 sigma confidence) and evidence for optical opacity, possibly attributable to H-, TiO and VO (combined significance of 3.8 sigma). Models that fit the data require a thermal inversion, molecular dissociation as predicted by chemical equilibrium, a solar heavy-element abundance ('metallicity', M/H= 1.03(-0.51)(+1.11) times solar) and a carbon-to-oxygen (C/O) ratio less than unity. The data also yield a dayside brightness temperature map, which shows a peak in temperature near the substellar point that decreases steeply and symmetrically with longitude towards the terminators.