Filtering can be done directly in the frequency domain, by operating on the signal's frequency spectrum:
The diagram shows how how a noisy sine wave can be cleaned up by operating directly upon its frequency spectrum to select only a range of frequencies that include signal frequency components but exclude much of the noise:
Filtering in the frequency domain is efficient, because every calculated sample of the filtered signal takes account of all the input samples.
Filtering in the frequency domain is sometimes called 'acausal' filtering because (at first sight) it violates the laws of cause and effect.
Because the frequency spectrum contains information about the whole of the signal - for all time values - samples early in the output take account of input values that are late in the signal, and so can be thought of as still to happen. The frequency domain filter 'looks ahead' to see what the signal is going to do, and so violates the laws of cause and effect. Of course this is nonsense - all it means is we delayed a little until the whole signal had been received before starting the filter calculation - so filtering directly in the frequency domain is perfectly permissible and in fact often the best method. It is often used in image processing.
There are good reasons why we might not be able to filter in the frequency domain:
None of the above reasons should make us ignore the possibility of frequency domain filtering, which is very often the best method. It is often used in image processing, or certain types of experiment where the data necessarily comes in bursts, such as NMR or infra red spectroscopy.