The White House has threatened a presidential veto of the legislation.
"We are trying to deliver a message to the politicians in Iraq that we are not going to sit around forever watching them dither, watching them refuse to compromise, while our troops die," David Obey, House appropriations committee chairman, said.
"Peace in Iraq will happen when citizens realise that they can express their ideas and views more effectively... than with violence"
JBernar5, Toledo, USA
Send us your views
The legislation marked the first time a congressional committee has voted to put binding limits on the duration of the war but the measure's future was uncertain.
Republicans had proposed removing the timetable from the bill.
"Nobody wants our troops out of Iraq more than I do," Bill Young, a Republican on the subcommittee that oversees military spending, said. "[But] we can't afford to turn over Iraq to al-Qaeda."
Hal Rogers, another Republican on the committee, called it an "ill-advised and precipitous withdrawal" plan.
House Democratic leaders are preparing for a close vote in the full House and the legislation is unlikely to pass the 100-member senate, where a 60-vote majority is often needed for controversial initiatives.
Later, the Senate rejected a plan by Democratic leaders to withdraw US troops by late March 2008, but agreed a resolution voicing support for the forces.
The bill fell short of a simple majority and the 60-votes needed to overcome Republican procedural hurdles and pass out of the Senate.
The largely symbolic resolution, presented by Patty Murray, a Democratic senator, stated that Congress and the president have a shared responsibility for soldiers in wartime and their medical when they are wounded.
Some Democrats have accused the Bush administration of sending soldiers into harms way before they are ready to enter combat, or are properly equipped.