President Barack Obama signed on Wednesday "fiscal cliff" legislation that raises tax rates for top earners and extends tax cuts for the middle class, the White House said.