When you something in such a way that it intones the opposite. That is sarcasm.
Best explained with examples:
This little excerpt from the US series “The Big Bang Theory” shows sarcasm. I think there’s nothing more to explain about it, is it?
But, if you need some further explanation…here we go:
“The use of remarks which clearly mean the opposite of what they say, and which are made in order to hurt someone’s feelings or to criticize something in an amusing way.” (Cambridge Advanced Learners Dictionary)
It is amusing indeed. I love sarcasm.