The Senate on Wednesday confirmed Jacob Lew to be Treasury secretary, affirming President Barack Obama's choice of a budget expert at a time when Congress and the White House are at odds over sharp government spending cuts.