The spike protein is part of COVID-19's infection mechanism.
The thinking (if I understand correctly) in targeting the spike protein was that mutations to the spike protein may render the vaccine less effective, but would also render COVID-19 less infectious.
It's a clever hack to rely not on whether the spike is mutation-prone, but instead on the odds that a mutation would result in a less effective virus that the vaccine wouldn't be necessary for.