The move ends months of speculation over the future of Last.fm, which allows people to listen to music based on the recommendations of other users. It launched five years ago and now has 15 million registered users across 200 countries.
Les Moonves, the CBS chief executive, said: "Last.fm is one of the most well-established, fastest-growing online community networks out there. Its demographics also play perfectly to CBS's goal to attract younger viewers and listeners across our businesses."
The deal will give CBS access to a network of young music fans to complement its status as the largest radio group in the US. Last.fm's management team will remain in place, and it will retain its own separate branding and identity.