Only Republicans Rick Santorum of Pennsylvania and Jim Bunning of Kentucky voted against Gates.
   
Senators from both parties praised the ex-CIA chief's candour. Gates had told them bluntly that the US was not winning the war in Iraq.

Edward Kennedy, a Massachusetts Democrat, said: "Dr Gates spoke with candour - a candour that has been sorely missing from the department of defence under this administration. He recognised the high price that our troops are paying for the current policy."

Daunting task
   
But senators also emphasised the daunting task before Gates in addressing Iraq, and their awareness that he must work with Bush.

Jack Reed, a Rhode Island Democrat, said during the debate: "Dr Gates is poised to take an extraordinarily difficult job at one of the most dangerous times in American history."
 
Arlen Specter, a Pennsylvania Republican, said: "We see the possibilities of a new chapter ... but it is up to the commander in chief to structure a change in policy."
   
Bush telephoned Gates to congratulate him on his confirmation, the White House said.

Dana Perino, a White House spokeswoman, said Gates would be sworn in on December 18.
   
Priority is Iraq

Gates says Iraq will be his first priority in his new post.

He plans to travel to Baghdad soon, where he intends to talk to US commanders.
   
Bush nominated Gates, a CIA director during the administration of Bush's father, last month after voters swept Republicans out of power in an election driven in large part by frustration over the Iraq war.
   
In the more than three years since the US-led invasion, the conflict has claimed the lives of more than 2,900 Americans and tens of thousands of Iraqis.
   
Bush has said he will consider alternatives, including those offered on Wednesday by the bipartisan Iraq Study Group. Gates said he believed that all options were on the table.
   
But not every senator who backed Gates favours cutting US troops in Iraq.

Lindsey Graham, a South Carolina Republican, told the senate that he favoured a "surge" of more US troops in the near term to get the violence under control.
   
He said: "I do hope that he will commit himself to winning this war, and the way to win is to provide security so the political process can be successful."