More than 50 years ago, John Bell proved that no theory of nature that obeys locality and realism can reproduce all the predictions of quantum theory: in any local-realist theory, the correlations between outcomes of measurements on distant particles satisfy an inequality that can be violated if the particles are entangled. Numerous Bell inequality tests have been reported; however, all experiments reported so far required additional assumptions to obtain a contradiction with local realism, resulting in `loopholes'. Here we report a Bell experiment that is free of any such additional assumption and thus directly tests the principles underlying Bell's inequality. We use an event-ready scheme that enables the generation of robust entanglement between distant electron spins (estimated state fidelity of 0.92 +/- 0.03). Efficient spin read-out avoids the fair-sampling assumption (detection loophole), while the use of fast random-basis selection and spin read-out combined with a spatial separation of 1.3 kilometres ensure the required locality conditions. We performed 245 trials that tested the CHSH-Bell inequality S <= 2 and found S = 2.42 +/- 0.20 (where S quantifies the correlation between measurement outcomes). A null-hypothesis test yields a probability of at most P = 0.039 that a local-realist model for space-like separated sites could produce data with a violation at least as large as we observe, even when allowing for memory in the devices. Our data hence imply statistically significant rejection of the local-realist null hypothesis. This conclusion may be further consolidated in future experiments; for instance, reaching a value of P = 0.001 would require approximately 700 trials for an observed S = 2.4. With improvements, our experiment could be used for testing less-conventional theories, and for implementing device-independent quantum-secure communication and randomness certification.