It means the EU could withhold funding if member countries breached the bloc's core values. Hungary called it political blackmail.
A deal has been reached that would give Brussels the green light to cut EU funding to member countries over rule of law issues.
European leaders agreed a €1.8 trillion budget and coronavirus recovery package after a marathon summit in the summer.
But it needed the approval of MEPs and they insisted upon linking respect for rule of law — which includes democratic values, human rights and the independence of the judiciary — to EU funding transfers to member states.
Now negotiators for the European Parliament and the Council of EU — which represents the heads of state of individual member countries — have reached an agreement.
The new mechanism would allow a particular EU country to be penalised if a majority of other member states approve.
It means the likes of Poland or Hungary — who have clashed with the EU in recent years — could have their funding cut without them being able to veto it.
The agreement still requires the final approval of the European Parliament and the Council of EU. It is part of much wider negotiations over the €1.8 trillion budget and COVID-19 economic recovery package.
Hungary's justice minister, Judit Varga, said on Facebook: "It is unacceptable that, despite the current pandemic and the serious challenges facing the European economy, the European Parliament persists with its political and ideological blackmail on Hungary."
One of the MEPs involved in the process, Petri Sarvamaa, told Euronews: "It's a very complex tool and mechanism, and substance-wise we got everything we asked for.
“The values are there, the scope is open, it's preventative, it doesn't just include things that have happened in the past. It talks about seriously risking the independence of the judiciary, so the Commission will now have a real tool that they can use ... the Council gave a lot, which to me says that they really, really wanted to have this deal."
"For the first time in Europe, we now have a mechanism that links the disbursement of EU funds to compliance with the rule of law," said Green MEP Daniel Freund. "This is a step forward for the protection of European values. The mechanism is not as powerful as we in the European Parliament would have liked. But: the compromise is much stronger than what the German Council Presidency presented a few weeks ago."
"Now the member states must prove that this sanctions mechanism can also be applied. The rule of law in Europe is in a deep crisis. The current developments in Poland and Hungary show this in a depressing way. We must now react decisively - also with sanctions against the Member States. The value of this mechanism will be measured by how quickly it can be implemented."
Some EU experts view the move as significant.
Alberto Alemanno, a professor in EU Law at Paris business school HEC, acknowledged the mechanism still has to go through a vote in parliament and council and will only apply for future breaches of the rule of law.
But he added: “All that has occurred in the past won't be subject, per se, to such a mechanism, but of course, since some of those breaches have been persistent and continued, well, the Commission, which has the ownership and trigger of this mechanism, will be able to use it in order to look at the current circumstances - the lack of judicial independence in Poland or the same in Hungary."
Questions have been raised many times in the past about Hungary and Poland’s adherence to the EU’s rule of principles around freedom of the media, an independent judiciary and civil society. Critics accuse the governing parties in both countries of undermining and challenging democratic principles. Something they have both denied.
The new deal isn’t broad enough to include all issues but rather only ones that "affect or seriously risk affecting the sound financial management of the EU budget or the protection of the financial interests of the union in a sufficiently direct way."
Negotiations between the European Parliament and Council of Europe on the overall seven-year budget and recovery will now continue.