The oath of office was administered by Vice President Joe Biden.
Lew is the 76th treasury secretary, succeeding Timothy Geithner, who announced his departure soon after Obama won his second term.
During his daily media briefing, White House press secretary Jay Carney said Obama and Lew "have become close through their service together, and the president wanted to have this ceremony for Secretary Lew, in the Oval Office, because of that relationship."
Lew had been Obama's chief of staff and before that was budget director for Obama and President Bill Clinton.
The U.S. Senate Wednesday handily confirmed Lew as treasury secretary Wednesday, despite reservations by some Republicans, on a 71-26 vote. Lew had come under criticism from some GOP senators for his personal finances and connections with Wall Street.