There is a JSON file at http://xkcd.com/info.0.json which contains the details for the current strip. Details for past strips are also available at http://xkcd.com/123/info.0.json. If you need to access it from another page with JavaScript, there is a JSONP proxy at http://dynamic.xkcd.com/api-0/jsonp/comic/ for the latest strip, or http://dynamic.xkcd.com/api-0/jsonp/comic/123 for a specific strip... this accepts the usual ?callback=whatever parameter, so you can use it with jQuery or whatever. The JSONP proxy is slightly less reliable, though, and if you can use the static JSON file directly then you should.
This is, quite simply, the best way to get the latest comic. It's easy to parse, and most likely to remain consistent... compared to scraping information out of the HTML page (harder, and more fragile if the page format changes), or scraping from the RSS feed (even more fragile, for the reasons davean goes into below). The JSON, however, is easy to get, easily machine-readable (there are libraries out there for pretty much any language you want to use), simple to get the data out of, and unlikely to change drastically in the future. Save yourself the pain and use it. Thank you.
The original OP has been thrown into a spoiler tag for being out-of-date (it recommends scraping the HTML, only because the JSON didn't exist yet at the point this post was made).

