Small infrared target detection in complex backgrounds is a challenging task. Due to dynamic background clutter and low signal-to-clutter ratio, most conventional methods fail to produce satisfactory results. In this paper, an effective spatial and temporal filter is proposed. The spatial filter is used to remove cloud edge, and the temporal filter is used to remove point-like background clutter. Experimental results demonstrate that the proposed method can effectively detect dim small targets with a very low false alarm rate and an acceptable detection rate.