We report on simultaneous broadband observations of the TeV-emitting blazar Markarian 501 between 1 April and 10 August 2013, including the first detailed characterization of the synchrotron peak with Swift and NuSTAR. During the campaign, the nearby BL Lac object was observed in both a quiescent and an elevated state. The broadband campaign includes observations with NuSTAR, MAGIC, VERITAS, the Fermi Large Area Telescope (LAT), Swift X-ray Telescope and UV Optical Telescope, various ground-based optical instruments, including the GASP-WEBT program, as well as radio observations by OVRO, Metsahovi and the F-Gamma consortium. Some of the MAGIC observations were affected by a sand layer from the Saharan desert, and had to be corrected using event-by-event corrections derived with a LIDAR (LIght Detection And Ranging) facility. This is the first time that LIDAR information is used to produce a physics result with Cherenkov Telescope data taken during adverse atmospheric conditions, and hence sets a precedent for the current and future ground-based gamma-ray instruments. The NuSTAR instrument provides unprecedented sensitivity in hard X-rays, showing the source to display a spectral energy distribution between 3 and 79 keV consistent with a log-parabolic spectrum and hard X-ray variability on hour timescales. None (of the four extended NuSTAR observations) shows evidence of the onset of inverse-Compton emission at hard X-ray energies. We apply a single-zone equilibrium synchrotron self-Compton model to five simultaneous broadband spectral energy distributions. We find that the synchrotron self-Compton model can reproduce the observed broadband states through a decrease in the magnetic field strength coinciding with an increase in the luminosity and hardness of the relativistic leptons responsible for the high-energy emission.