ABSTRACT The detection of the binary neutron star merger GW170817 together with the observation of electromagnetic counterparts across the entire spectrum inaugurated a new era of multimessenger astronomy. In this study, we incorporate wavelength-dependent opacities and emissivities calculated from atomic-structure data enabling us to model both the measured light curves and spectra of the electromagnetic transient AT2017gfo. Best fits of the observational data are obtained by Gaussian Process Regression, which allows us to present posterior samples for the kilonova and source properties connected to GW170817. Incorporating constraints obtained from the gravitational wave signal measured by the LIGO-Virgo Scientific Collaboration, we present a $90{{\ \rm per\ cent}}$ upper bound on the mass ratio q ≲ 1.38 and a lower bound on the tidal deformability of $\tilde{\Lambda } \gtrsim 197$, which rules out sufficiently soft equations of state. Our analysis is a path-finder for more realistic kilonova models and shows how the combination of gravitational wave and electromagnetic measurements allow for stringent constraints on the source parameters and the supranuclear equation of state.