The vote was 71-26, Washington publication Roll Call reported.
"I am pleased that the Senate took bipartisan action today to confirm Jack Lew as our nation's next treasury secretary," President Obama said in a statement released by the Treasury Department.
"At this critical time for our economy and our country, there is no one more qualified for this position than Jack. As my chief of staff, Jack was by my side as we confronted our nation's toughest challenges. His reputation as a master of fiscal issues who can work with leaders on both sides of the aisle has already helped him succeed in some of the toughest jobs in Washington.
"And I will continue to rely on his advice and sound judgment as we work to create good, middle-class jobs, provide more people with the skills those jobs require, and ensure every hardworking American can earn a decent living," Obama said.
Lew, who succeeds Tim Geithner, had come under criticism from some GOP senators for his personal finances and connections with Wall Street. Minority Leader Mitch McConnell of Kentucky was among those who voted against confirming Lew, as did Sen. Bernard Sanders, an independent from Vermont, Roll Call noted.
Sen. Orrin Hatch of Utah, the ranking Republican on the Senate Finance Committee, voted in favor of confirming Lew, though he expressed having "no small amount of reservation."
"I have serious disagreements with [Lew] when it comes to policy," Hatch said, but allowed that "any president, really, regardless of party, is owed a certain degree of deference when choosing people to work in his administration."
Finance Chairman Max Baucus, D-Mont., countered Lew was straightforward during the confirmation process.
"Senators on both sides of the aisle spoke to his character and his integrity," Baucus said. "He's well qualified to be the nation's next treasury secretary and equipped to restore confidence and trust in our economy. It will be his touchstone."
Lew had been Obama's chief of staff and before that was budget director for Obama and President Bill Clinton.