Salesforce.com Inc. continued to post strong revenue growth and offered an optimistic forecast, even as it posted a loss in the most recent quarter.

The business software provider said it would reach $10 billion in annual revenue by January 2018, setting a time frame for reaching one of the company’s longstanding goals.

The company, reporting...