Description and performance of the Fermilab E687 spectrometer