Is It Permissible to Kill Insects?

We often encounter situations where small insects cause inconvenience in everyday life — enter homes, spoil food, or cause other harm. Is it permissible in such cases to destroy insects?