With its dominant position in music threatened by a decline in download sales, Apple Inc. is preparing to launch a direct rival to Spotify AB and other popular services that let users stream songs instead of buy them.

The tech giant is betting that for the second time in as many decades it can persuade millions of people around the world to change how they listen to and pay for music. In 2003, the company’s iTunes Music Store made downloading individual songs the most common way for people to buy music—and made iTunes the...