The government is taking legal action over rules it says would allow non-EU nationals in the UK to claim benefits without working or paying taxes.
Ministers say citizens from countries such as Norway or Iceland could be eligible as a result of agreements with the EU and this is "unacceptable".
Legal action sent a "clear message" on who determines welfare, they argue.
The European Commission said the UK was in "full control" of who was entitled to live and work in the country.
Brussels has said the UK is already contravening EU law by making it easier for UK citizens to obtain certain benefits than nationals of other EU states.
It has said the UK must explain how it is going to bring its legislation into line with EU law but ministers fear taxpayers could be forced into handing out more than £2bn to non-UK citizens - including so-called "benefits tourists" who are not looking for work - if the UK has to comply.
In an apparent escalation of the dispute, the UK said it was taking action over the specific issue of whether citizens from European Economic Area countries - Norway, Iceland and Lichtenstein - should be eligible for benefits as a result of the EEA's agreements with the EU.
Ministers said they were taking the case to the European Court of Justice arguing the legal basis for a decision by the EU in July was "incorrect" and therefore "invalid".
The UK says it has an "opt-out" under existing EU Treaties which means it is within its right to stop "non-active" migrants from outside the EU receiving benefits.
"We remain absolutely clear that it is wrong for people from other countries to get our benefits without working and paying taxes in this country," employment minister Chris Grayling said.
"This legal action is designed to send a clear message that this is not acceptable."
'Right to reside'
At the moment, the UK grants entitlements such as child benefit, child tax credit, state pension credit, jobseekers' allowance and employment and support allowance to those with a "right to reside".
The Commission says there are already EU-wide "habitual residence" rules which are strict enough and the UK is imposing an additional test, which indirectly discriminates against non-UK EU nationals.
Factors taken into account when determining "habitual residence" include how long someone has been in the country, how integrated they are within the surrounding community, whether they rent or own property and whether their children go to school locally.
The UK says there is no "statutory definition" of habitual residence and common sense must be used in interpreting the rules as well as relevant legal precedents.
While UK nationals can easily prove their "right to reside" based on their UK citizenship, the Commission says other EU nationals have their applications heard on a case-by-case basis, which breaches EU social security co-ordination rules giving all citizens equal rights within a single EU labour market.
In challenging the UK, the European Commission says it is responding to the "huge number" of complaints from EU citizens living in the UK who have been refused access to benefits and its legal arguments are "sound".
Concerns have also been expressed that existing rules could enable migrants from certain countries in North Africa to qualify for benefits in future.
It has been suggested that "reciprocity" arrangements between the EU and EEA could be extended to countries such as Morocco, Tunisia and Algeria with which the EU has "association agreements" covering social, cultural and economic co-operation.
Ministers say they would take a "pretty robust line" on any attempt to make it comply but the Commission said it would involve only "limited provisions".