iLocater is a near-infrared, extremely precise radial velocity (EPRV) spectrograph under construction for the dual 8.4 m diameter Large Binocular Telescope (LBT). The instrument will undertake precision radial velocity studies of Earth-like planets orbiting low-mass stars. Operating in the diffraction-limited regime, iLocater uses adaptive optics to efficiently inject starlight directly into single-mode fibers that illuminate a high spectral resolution (R=190,500 median), cryogenic, diffraction-limited spectrograph. To maximize performance, the spectrograph uses a new design strategy for EPRV instruments, combining intrinsically stable materials for its optomechanical fabrication with precision optical fabrication. This novel combination will enable unique EPRV capabilities for exoplanet and astrophysics studies of the solar neighborhood.We present the final optical and mechanical designs of the spectrograph system. Ensuring the as-built spectrograph achieves its designed spectral resolution and diffraction-limited performance has required careful control of the end-to-end system wavefront error (WFE) budget. We discuss the efforts undertaken to achieve this goal including minimizing residual WFE in the optical design, assessing diffraction grating WFE performance, optimizing material choices, and requiring precision optical design and fabrication. Our goal is to deliver diffraction-limited performance across the full spectral format, which, combined with intrinsic thermal stability requirements for EPRV science, has driven the selection of silicon optics and Invar optomechanics. The system performance is further optimized using precision (sub-mK) thermal control. This set of design features will allow iLocater to achieve sub-m/s radial velocity precision in the near-infrared, and to serve as the first optimized diffraction-limited spectrograph for EPRV science.