President Barack Obama signed a debt- limit compromise that prevents a U.S. default on the day the Treasury had warned the nation’s borrowing authority would expire, ending a months-long debate that reinforced partisan divisions over federal spending.