We report the discovery of a 206 ms pulsar associated with the TeV γ-ray source HESS J1640-465 using the Nuclear Spectroscopic Telescope Array (NuSTAR) X-ray observatory. PSR J1640-4631 lies within the shell-type supernova remnant (SNR) G338.3-0.0, and coincides with an X-ray point source and putative pulsar wind nebula (PWN) previously identified in XMM-Newton and Chandra images. It is spinning down rapidly with period derivative 9.758(44) × 10-13, yielding a spin-down luminosity 4.4 × 1036 erg s-1, characteristic age 3350 yr, and surface dipole magnetic field strength Bs = 1.4 × 1013 G. For the measured distance of 12 kpc to G338.3-0.0, the 0.2-10 TeV luminosity of HESS J1640-465 is 6% of the pulsar's present . The Fermi source 1FHL J1640.5-4634 is marginally coincident with PSR J1640-4631, but we find no γ-ray pulsations in a search using five years of Fermi Large Area Telescope (LAT) data. The pulsar energetics support an evolutionary PWN model for the broadband spectrum of HESS J1640-465, provided that the pulsar's braking index is n ≈ 2, and that its initial spin period was P ~ 15 ms.