The Spanish prime minister has suggested that an independent Scotland would have to apply to become a member of the EU from the outside.
Mariano Rajoy said that if a "region" opted to leave a member state, then it would "remain outside the European Union".
It would then require the agreement of all 28 EU members before it was allowed to join, he said.
The Scottish government aims to negotiate entry from within the EU.
This would be done in the 18 months between a Yes vote and formal secession from the UK, it has said.
Speaking at a media conference during a summit with French president Francois Hollande, Mr Rajoy said: "I do not know the White Paper presented by the Scottish president (sic).
"I would like that the consequences of that secession be presented with realism to Scots.
"Citizens have the right to be well informed and particularly when it's about taking decisions like this one.
"I respect all the decisions taken by the British, but I know for sure that a region that would separate from a member state of the European Union would remain outside the European Union and that should be known by the Scots and the rest of the European citizens".
His stance appeared to echo the official position of the European Union.
However, Mr Rajoy did not say he would seek to block an independent Scotland's subsequent entry to the EU.
The BBC's Tom Burridge, in Madrid, said the Spanish prime minister's comments were being seen as an implicit warning to the Spanish region of Catalonia, whose autonomous government wants to hold a vote on independence.
Mr Rajoy strongly opposes having an independence referendum in Catalonia, in north-eastern Spain.
But the Catalan government says it plans to announce the date of its referendum, and the question it will put to Catalan voters, before the end of this year.
Speaking on Newsnight Scotland, Finance Secretary John Swinney said Scotland was already part of the European Union by virtue of its membership as part of the UK.
To gain membership as an independent state, he said Scotland would apply for an amendment to The Treaty on European Union under Article 48.
This would need to be approved by all 28 member states.
"We are members of the European Union," he said.
"Once Scotland votes for independence - a Yes vote in September 2014 - we remain still within the European Union and the day of independence doesn't happen until 2016.
"So we are doing this from within the European Union as part of our membership."
Scottish Labour leader Johann Lamont said the Scottish government had previously said that under independence its membership as an independent state would be automatic.
She said: "If you move to a position where it would be automatic to saying you would need agreement, then you have to contemplate the possibility that somebody might disagree."
Responding to Mr Swinney, she said: "You have told us in the past you want to remain within the European Union.
"It would now appear that's assertion, like so much in here, rather than actual documented fact."
The Scottish government's White Paper on independence, which was published on Tuesday, devotes about nine pages to EU membership.
It has also published a further 100-page document which focuses on the EU.
Writing in the document's foreword, Deputy First Minister Nicola Sturgeon said the government recognised that EU membership would require negotiations with other member states and institutions.
But this could be done from within the organisation in the period between a Yes vote in September next year and day one of independence in March 2016, she argued.
The report asserted that it was wrong on three counts to say Scotland would have to leave the EU and reapply from outside:
- Scotland has been an integral part of the EU for 40 years
- It would be against the self-interest of the EU collectively and individually
- It would deny the democratically expressed wishes of the Scottish people
A spokesman for the Deputy First Minister said: "Scotland's future is first and foremost a matter for the people of Scotland.
"We note that the Spanish Prime Minister has said he has not read our proposals, but Mr Rajoy has previously indicated that he considers the Scottish and Catalan situations are 'absolutely and totally different'.
"That is because the process for Scotland becoming independent is enshrined in the Edinburgh Agreement, where the UK government has pledged to respect the outcome of the referendum.
"As the papers we have published outline, we have detailed a process which will see Scotland negotiate its position as an independent member of the European Union from within, during the 18-month period between a Yes vote and independence day - a period when we will still be part of the EU as part of the UK, and which has been described as 'realistic' by the UK government's own legal adviser.
"That process, under Article 48 of the Treaty of the EU, allows for Scotland to become a member state at the point of independence.
"Scotland is already an integral part of the EU, and there is nothing in the entire body of EU treaties which provides for the expulsion of an existing territory or the removal of its inhabitants' rights as EU citizens."
But Better Together leader Alistair Darling said Mr Rajoy's comments were "another blow to Alex Salmond's claims that nothing would change if we vote to go it alone".
He added: "The Spanish Prime Minister has just made it clear that everything would change.
"We now know what the position of the Spanish government would be if we vote for independence. This has created even more uncertainty."
Scottish Conservative leader Ruth Davidson said: "The Spanish prime minister has just blown Alex Salmond's case for EU entry out of the water.
"We need to know what advice the SNP received before they laid out their threadbare case in the White Paper, whether they'd spoken to other member states or even checked basic facts with EU officials."