The deal lifted the threat of bankruptcy hanging over Greece, but also committed it to honor tough fiscal targets.