Spain maintains a claim to the peninsula, ceded to the British crown under the 1713 Treaty of Utrecht.
It wants to ensure that future EU talks with the UK do not cover Gibraltar.
"As things stand today if there are no changes regarding Gibraltar, Spain will vote no on Brexit," said Mr Sánchez.
Throughout the Brexit negotiations, Spain - along with Ireland and Cyprus - has conducted separate talks with the UK about specific border issues.
On Monday Spanish Foreign Minister Josep Borrell spelt out that the draft Brexit deal failed to make clear that talks on Gibraltar were "separate negotiations" and not part of future talks between the UK and EU.
Mr Sánchez added his weight to those remarks on Tuesday at a forum in Madrid, emphasising that any future negotiations on Gibraltar had to be bilateral.
"As a country we cannot assume that whatever happens in the future with Gibraltar would be negotiated by the UK and EU - it will have to be negotiated between Spain and the UK," he said. [...]
Related article on The Telegraph: Scotland should be free to rejoin EU, says Spanish foreign minister, as he predicts break up of Brexit Britain