Slovenes have narrowly voted in favour of accepting a deal on a border dispute with Croatia, in a national referendum.
The border dispute concerns the small Bay of Piran in the Adriatic Sea, and dates back to the break-up of Yugoslavia in 1991.
It has soured relations between the two countries, and led Slovenia to block Croatia's bid to join the EU.
BBC Balkans correspondent Mark Lowen reports that just under 52% of those who voted in the Slovenian referendum backed the agreement with Croatia.
Parliaments in both Slovenia and Croatia had approved the deal, but the centre-right opposition in Slovenia branded the agreement as a "capitulation" that favoured Croatia.
Slovene Prime Minister Borut Pahor accepted the opposition's demand for a binding referendum in March.
'Setting an example'
But Slovenia, which has a much shorter coastline than its neighbour, had feared this would deny its ships direct passage to the high seas.
Slovenia exercised its veto on Croatia's EU accession talks because it said Croatia had provided maps and documents in negotiations that failed to take account of Slovenia's position.
Croatia hopes to become the second former Yugoslav state to join the EU in 2012.
Our correspondent says that by appearing to agree on a solution to the row last autumn, both countries tried to set an example to other parts of the Western Balkans - they hoped to demonstrate that through compromise and a shared European future, bilateral issues could be resolved.
The hope was to influence ties between Serbia and Kosovo, whose declaration of independence from Serbia is rejected by Belgrade, or between Bosnia and Serbia, whose relations have remained tense since the Bosnian war.