WATERLOO, Ontario—BlackBerry Ltd.’s plan to expand its mobile software and services operations helped the smartphone maker’s bottom line in its latest quarter, but sliding handset sales weighed heavily on revenue, which fell 39%.

The Canadian smartphone maker has been focusing on mobile-device software and services for governments and businesses to drive growth after falling far behind in the consumer smartphone market.

BlackBerry’s...