In iMessage, you'll need to tap the app button to find the Spotify icon, which will appear if you have the latest Spotify app on your iPhone. You can then search Spotify for any tracks you want to share with your buddies on iMessage. Tapping the song you want to share puts a little preview and link in iMessage, similar to the way you can share songs from the Spotify app itself. The difference here seems to be that when you share via the new Spotify iMessage app, your recipient gets a full screen preview of the track in iMessage. When you share from the main app to iMessages, your friend gets taken to the main Spotify app or a web page.
Once your friend gets the song you shared in iMessage, they can play a 30-second preview, or they can hit the Play on Spotify button. If they're a Spotify member, they'll also see a little Spotify icon in the upper left corner of the iMessage screen. They'll need to enable the new Spotify iMessage app, however, to access the preview.
Compared to the Apple Music iMessage app (as noted by MacRumors), which only shares from a recently listened track list, the Spotify feature enables a full-library search without having to drop out of your conversation to use the main Spotify app.