A device and method for performing spectral measurements in flow cells with spatial resolution using a variable transmission optical filter having at least two areas with different optical properties. Light from a light source passes through the variable transmission filter to a flow cell containing a sample to be analyzed. The resultant light pattern is sensed by a detecting means, which analyzes the spectral properties of the sample within the flow cell.