The vote was close, 50 to 48, and mostly along party lines in the Senate, now just barely controlled by the opposition Democrats.
The vote defeated a Republican-proposed amendment that would have erased language of a withdrawal timeline from a $121 billion bill to provide funding for the wars in Iraq and Afghanistan.
Commentators say it is the Senate's biggest challenge yet to President George W. Bush handling of the war.
After the vote, White House spokeswoman Dana Perino said Bush "was disappointed that the Senate continues down a path with a bill that he will veto and has no chance of becoming law."
Bush has said he will veto any bill that includes a withdrawal timetable.
But Democratic Senator Chuck Schumer (New York) said the Senate will continue to push for a new policy in Iraq.
"This is not one battle, it's a long-term campaign to persuade the president, to pressure the president, to change course," Schumer said.
The Senate troop-withdrawal vote came four days after the House passed its version of a war-spending bill setting a mandatory September 1, 2008, deadline for getting all U.S. combat troops out of Iraq.
(Reuters, AP)