The 47-47 vote along strict party lines fell short of the 60 yes votes required to launch debate in the 100-member Senate on a bill titled the Domestic Terrorism Prevention Act.
The vote effectively blocked the bill which would have authorized federal agencies to monitor and report jointly on domestic terrorism within the United States, including incidents related to white supremacy.
Republicans said the legislation was unnecessary as Democratic President Joe Biden already had the authority to organize his administration's response to violent extremism.
Democrats said the bill was needed to bolster the federal government's response to rising incidents of violent extremism. They said amendments to any such bill could address potential restrictions on guns.
Mass shootings in recent years have provoked discussion in Congress on what to do about gun violence but little action as the two parties are deeply divided on gun restrictions.
Americans have little confidence in Congress' ability to solve the problem, with a Reuters/Ipsos poll on Tuesday showing that just 35% believe lawmakers will act. read more
The House of Representatives passed the domestic terrorism bill along party lines last week, after an avowed white supremacist killed the 10 Black people in a livestreamed shooting at a supermarket in Buffalo, New York, on May 14.
On Tuesday, a gunman stormed a school in Uvalde, Texas, and killed the 9- and 10-year-old children and two teachers.
Senate Democrats and some Republicans have discussed the possibility of bipartisan legislation to address mass shootings, including proposals to expand background checks for gun purchasers and to keep guns out of the hands of the mentally ill.
Some 79% of Americans - including 78% of Republicans - are more likely to vote for a candidate in November's congressional election who supports passing red flag laws of that kind, the Reuters/Ipsos poll found.
Senate Majority Leader Chuck Schumer said that at least five Democratic lawmakers including Senator Chris Murphy have reached out to Republicans about possible measures related to gun and school safety.
Murphy, a leading advocate for gun restrictions, told a news conference that talks with Republicans were expected on Thursday and would continue through next week. But the odds are slim at best that the Senate will enact any bill to restrict guns.
"None of us are under any illusions that this will be easy," Schumer said on the Senate floor, accusing Republicans of being in the "vice grip" of the U.S. gun lobby. But he added: "We need to give it a short amount of time to try."
Schumer's Republican counterpart, Minority Leader Mitch McConnell, told reporters that any proposal capable of passing the Senate would need to be limited to address "the facts" of the Texas massacre. He did not elaborate but Republicans broadly oppose new gun restrictions that would infringe on the rights of law-abiding gun owners.
Other Republicans expressed potential interest in red-flag legislation that would encourage states to deny firearms to anyone found mentally unstable or dangerous, possibly using unspent COVID-19 funding to pay for the initiative.
With the 100-seat Senate split 50-50, gun legislation would need 10 Republican votes to meet the chamber's 60-vote threshold for passing most bills.