Spotify, the Swedish streaming music service, is buying The Echo Nest, a data company that has analyzed more than 35 million songs.
With the acquisition, Spotify will improve the ways users discover new music, the company said Thursday.
The move comes as Spotify, founded in 2008, faces increasing competition from rivals such as the heavily promoted Beats Music, launched in January by headphone company Beats Electronics.
The Echo Nest will keep its Somerville headquarters and continue to operate out of its San Francisco office, the company said.
Earlier this week, Beats Music announced that it will acquire Topspin Media, a maker of software that helps musical artists sell and promote their music and merchandise to fans online.