var els = document.getElementsByTagName('span'),
    highest = 0,
    i,
    cur;
for (i = 0; i < els.length; i++) {
    cur = parseInt(els[i].id, 10);
    if (els[i].id > highest) {
        highest = cur;
    }
}
highest will contain the highest value.
NB however that, in HTML4, it is illegal for an element ID to start with a non-alphabetic character:
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). (source)
This is not an issue if you are using HTML5.  And, what's more, it will probably work anyway.