The Republican-sponsored bill, H.R. 6429, would have eliminated a diversity program offering 55,000 visas in a lottery system to citizens of countries with low rates of emigration to the United States.
Despite the defection of 30 Democrats who voted with Republicans, the vote, in which a two-thirds majority was required, fell short -- 257-158, the Washington newspaper The Hill reported Friday.
The bill was directed at immigrants arriving with advanced degrees in science, technology, engineering and math, known as STEM skills.
"This bill makes our immigration system smarter by admitting those who have the education and skills America needs. STEM visas are substituted for diversity visas, which invite fraud and security risk," said House Judiciary Chairman Lamar Smith, R-Texas.
"It appears to have another, in my opinion, more sinister purpose, to actually reduce legal immigration levels," said Rep. Zoe Lofgren, D-Calif.
Democrats also argued the bill would allow visas to graduates of for-profit schools that might have lower academic standards, the newspaper said.