Read a pretty good post at 6 figure Career Management about how to handle a counter-offer, and for those so fortunate as to find themselves in this position, a great list of tips.
Back when I worked for someone else, I held the view that counter-offers were almost offensive: If your boss really thought you were worth the counter, why didn't he/she come up with it earlier? I've since softened my view on this a little because there are situations where the boss has bad data, or has been given bad direction, or the market is moving faster than they recognized. Hey, things change, and we're all busy. In light of this, it's probably not a bad idea to give the counter due consideration.