It communicates using the public Spotify metadata search API which you
can read about here: http://developer.spotify.com/en/metadata-api/search/.
It currently uses NSXMLParser in a way that means it will work in
iPhone/iPad apps as well as desktop Cocoa.
There is an example app in the source, which can be found here:
http://bitbucket.org/jaredholdcroft/jhspotifyengine/
(Arch based on MGTwitterEngine by Matt Gemmell)