On 2017 August 17, the gravitational-wave event GW170817 was observed by the Advanced LIGO and Virgo detectors, and the gamma-ray burst (GRB) GRB 170817A was observed independently by the Fermi Gamma-ray Burst Monitor, and the Anti-Coincidence Shield for the Spectrometer for the International Gamma-Ray Astrophysics Laboratory. The probability of the near-simultaneous temporal and spatial observation of GRB 170817A and GW170817 occurring by chance is 5.0 x 10-8. We therefore confirm binary neutron star mergers as a progenitor of short GRBs. The association of GW170817 and GRB 170817A provides new insight into fundamental physics and the origin of short GRBs. We use the observed time delay of (+1.74 ± 0.05) s between GRB 170817A and GW170817 to: (i) constrain the difference between the speed of gravity and the speed of light to be between -3 x 10-15 and +7 x 10-16 times the speed of light, (ii) place new bounds on the violation of Lorentz invariance, (iii) present a new test of the equivalence principle by constraining the Shapiro delay between gravitational and electromagnetic radiation. We also use the time delay to constrain the size and bulk Lorentz factor of the region emitting the gamma-rays. GRB 170817A is the closest short GRB with a known distance, but is between 2 and 6 orders of magnitude less energetic than other bursts with measured redshift. A new generation of gamma-ray detectors, and subthreshold searches in existing detectors, will be essential to detect similar short bursts at greater distances. Finally, we predict a joint detection rate for the Fermi Gamma-ray Burst Monitor and the Advanced LIGO and Virgo detectors of 0.1–1.4 per year during the 2018–2019 observing run and 0.3–1.7 per year at design sensitivity.