Stay as calm as you can, try not to get involved, but don't give in. If you've said 'no', don't change your mind and say 'yes' just to end the tantrum. If you do change your mind, your child will think that tantrums pay. For the same reason, don't buy your way out with sweets or treats. If you're at home, you could try walking away into another room.
Tantrums often seem to happen in shops.
This can be really embarrassing, and embarrassment makes it extra hard to cope and stay calm. Keep shopping trips short. You could start by going out to buy one or two things only, and then build up from there. Once you've managed one quick trip without trouble, you're beginning to make progress. Some parents find it helps to hold their child, quite firmly, until the tantrum passes.