Serbia and its former province of Kosovo have reached an EU-brokered accord aimed at normalising relations between the Balkan neighbours.
Under the new deal, Serbs in northern Kosovo will have their own police and appeal court.
Both sides also agreed to not block each other's efforts to seek EU membership.
Kosovo broke away in 2008. While many countries recognise it as an independent country, Serbia does not.
Many minority ethnic Serbs in Kosovo have refused to recognise the authority of the mainly ethnic Albanian government in Pristina, since it unilaterally declared independence five years ago.
Brussels said it would open EU membership talks with Serbia if the country relinquished its de facto control over northern Kosovo.
'Heal the wounds'
Beyond its own police and appeal court, there is none of the autonomy that Serbia had originally been demanding as part of the talks, the BBC's Guy Delaunay reports from the Serbian capital Belgrade.
And there is certainly no recognition of Kosovo's independence by Belgrade, he adds.
However, the agreement should allow both sides to move on with plans for membership of the EU.
Brussels will see it as an important step in normalising relations, which may lead to Serbia getting its much coveted date for the start of EU membership talks, our correspondent says.
The deal was reached after months of tense negotiations between Serbian Prime Minister Ivica Dacic and Kosovo Prime Minister Hashim Thaci in Brussels.
"The negotiations have concluded. The text has been initialled by both prime ministers," said the EU's top diplomat, Catherine Ashton, who mediated the talks.
"What we are seeing is a step away from the past and, for both of them, a step closer to Europe."
Meanwhile Mr Thaci said the settlement would help pave the way for both Kosovo and Serbia to join the EU and Nato.
"This agreement will help us heal the wounds of the past if we have the wisdom and the knowledge to implement it in practice," he said.
Earlier this month, Serbia rejected an agreement proposal because the terms did not "guarantee full security and protection of human rights to the Serb people in Kosovo".
Tension between Kosovo's ethnic Albanian majority and remaining ethnic Serbs has led to violence in recent years, notably around customs posts in northern Kosovo.