David Cameron has described comments by a European commissioner about the UK's immigration policies as "unacceptable".
Laszlo Andor suggested the UK was at risk of becoming a "nasty" country if it curbed benefits and sought to limit freedom of movement by EU nationals.
Speaking at an EU summit in Lithuania, the prime minister said he expected "better behaviour" and it was not Mr Andor's job to criticise UK policies.
He also suggested the UK had widespread backing across Europe for its stance.
The Hungarian Mr Andor was reacting to government plans to tighten up the eligibility rules on welfare claims for EU nationals moving to the UK, describing them as an "unfortunate overreaction".
In future, if Mr Cameron has his way, citizens from other EU countries would not be able to claim out-of-work benefits for the first three months and would not be able to extend claims beyond six months if they have no genuine prospect of work.
Workers would have to prove their earnings to qualify while access to housing benefit would also be curbed.
Mr Cameron also said the EU needs to rethink its core principle of the freedom of movement across European borders, saying this should only apply to people genuinely seeking work and not welfare.
He has suggested income disparities across Europe have led to mass movements of people from east to west, which have not been good for migrants' home countries or the nations in which they settle.
Mr Andor, a former economist who is commissioner for employment and social affairs, said there was "hysteria" in the UK on the issue of immigration and the latest proposals "risked presenting the UK as a kind of nasty country in the European Union".
Mr Cameron, asked during his trip to Vilnius about Mr Andor's comments, said they were unjustified.
"I think it is completely unacceptable for Commissioner Andor to say what he said," he told journalists.
"Britain is one of the most open, generous, tolerant countries anywhere in the world, and to suggest otherwise is quite wrong.
"But what's important is that our generosity and tolerance shouldn't be abused.
"Commissioner Andor shouldn't say that, his salary is paid in part by British taxpayers, and I expect better behaviour in the future."
The prime minister said he had the backing of other EU countries for measures to tighten access to benefits.
"People moving to countries for a job is one thing but I'm not in favour of people moving to be able to claim benefits," he added.
"I've had strong support from other European countries who all face these similar pressures and want to put in place proper and sensible measures."
There are growing concerns in Germany, the Netherlands and Austria about the issue but the UK has been criticised in other quarters, the Bulgarian foreign minister saying its plans are "discriminatory".
Speaking on a visit to London, EU Home Affairs Commissioner Cecilia Malmstrom said the UK was a "wonderful country" but there was little evidence of so-called "benefit tourism".
She suggested that some of the changes to benefit rules could have been done "long ago" and are "perfectly in compliance" with the UK's treaty obligations.
But she added: "Freedom of movement has been of gigantic benefit to the UK - for the people who come here to work and who have contributed to the British economy, and for the hundreds of thousands, millions of Brits who live abroad and who work or retire at the Costa Del Sol.
"And we should by no means limit this. This is very important to defend."