  We present optical and ultraviolet spectra of the first electromagnetic
counterpart to a gravitational wave (GW) source, the binary neutron star merger
GW170817. Spectra were obtained nightly between 1.5 and 9.5 days post-merger,
using the SOAR and Magellan telescopes; the UV spectrum was obtained with the
\textit{Hubble Space Telescope} at 5.5 days. Our data reveal a rapidly-fading
blue component ($T\approx5500$ K at 1.5 days) that quickly reddens; spectra
later than $\gtrsim 4.5$ days peak beyond the optical regime. The spectra are
mostly featureless, although we identify a possible weak emission line at $\sim
7900$ \AA\ at $t\lesssim 4.5$ days. The colours, rapid evolution and
featureless spectrum are consistent with a "blue" kilonova from polar ejecta
comprised mainly of light $r$-process nuclei with atomic mass number $A\lesssim
140$. This indicates a sight-line within $\theta_{\rm obs}\lesssim 45^{\circ}$
of the orbital axis. Comparison to models suggests $\sim0.03$ M$_\odot$ of blue
ejecta, with a velocity of $\sim 0.3c$. The required lanthanide fraction is
$\sim 10^{-4}$, but this drops to $<10^{-5}$ in the outermost ejecta. The large
velocities point to a dynamical origin, rather than a disk wind, for this blue
component, suggesting that both binary constituents are neutron stars (as
opposed to a binary consisting of a neutron star and a black hole). For
dynamical ejecta, the high mass favors a small neutron star radius of $\lesssim
12$ km. This mass also supports the idea that neutron star mergers are a major
contributor to $r$-process nucleosynthesis.

High Energy Astrophysical Phenomena;Cosmology and Nongalactic Astrophysics;Solar and Stellar Astrophysics