Foreign Ministry spokesman Hong Lei on Thursday said there was no "anti-foreigner trend" in China.
"The Chinese government welcomes foreigners from all walks of life to come to China, and will offer various conveniences for their living and working, and protect their legitimate rights and interests," Hong said.
The opening-up policy will continue and the country's society is inclusive and harmonious, he said at a press briefing.
"Meanwhile, we ask foreigners in China to abide by Chinese laws and regulations, and respect the culture and customs of Chinese," he said.
Beijing police on Thursday said the recent crackdown on illegal foreign residents has not changed the city's friendly attitude toward foreigners.
Beijing police last week launched a 100-day campaign targeting foreigners who have entered, lived or worked in the city without the proper paperwork or permits.
Beijing is now home to about 120,000 foreign residents, and the majority of them have legal status and have made contributions to the city's development, said a spokesman from the Beijing Municipal Public Security Bureau.
"Beijing will stick to the policy of reform and opening up, and we sincerely welcome foreign friends to work and live in Beijing," the spokesman said, adding that police will continue to protect foreigners' legitimate rights and provide conveniences for their time living here.
The spokesman said the campaign was part of the effort to battle foreigner-related crimes, as police found that most such offenses are committed by foreigners lacking legal status.
Police have launched household checks and street checks, requiring foreigners to present valid identification. A hotline was also opened to encourage local residents to report any suspected violations.
Foreigners found to be violating relevant laws may face penalties ranging from fines or detention to deportation.
Since kicking off on May 15, the campaign has gained the spotlight on a series of misconduct by foreigners visiting or living in China.
Before the police campaign began, a video clip went viral on the Internet in China that showed a British national allegedly attempting to sexually assault a Chinese woman on the side of a road in downtown Beijing on May 8.
That incident and another case in which a Russian cellist insulted a female passenger on a train have set off online furor, with many netizens accusing them of exhibiting a blatant disrespect for Chinese laws and citizens.
However, there have also been voices against the reaction to, and excessive interpretations of, criminal and ethical cases involving foreigners, which some fear could lead to xenophobic sentiments.
"We should treat foreigners as our equals, neither vilifying them because of their offenses or deifying their good deeds," said Gao Zhuhao, who works at the Beijing Center for Chinese Studies.
Ryan Geulke, an American language student in Beijing, said the campaign has had little impact on his life and the lives of his friends.
"I view the campaign as a way for the government to regulate illegal residents, and as long as one is here legally and abides by Chinese laws, there is nothing to worry about for a foreigner," Geulke said.