We report a microelectromechanical (MEMS) tunable optical filter and its integration in a fluorescence microscope for high speed on-chip spectral measurements. This integration allows for measurements of any fluorescence sample placed onto the microscope stage. We demonstrate the system capabilities by taking spectral measurements of multicolor fluorescent beads and fluorescently labeled cells passing through a microfluidic cytometer. The system has applications in biological studies where the measurement of multiple fluorescent peaks is restricted by the detection method's speed and sensitivity.