The invention discloses an on-line analysis system for automatic pretreatment by adopting an ultra-high performance liquid chromatography / mass spectrum. The on-line analysis system has an automatic pretreatment mode and a post-column compensation mode, and comprises four chromatography pumps, two high-pressure switch valves, an automatic sample injector, an on-line diluter, an extraction column, an on-line filter, two sample rings, a miniature mixer, a chromatographic column, a tee joint, a mass spectrometry detector and the like. On-line dilution, extraction, desorption, separation, detection and post-column compensation analysis can be carried out on a target analyte in a liquid sample by combination of an on-line dilution / extraction / desorption device, a stigma focusing device, a post-column compensation device and an ultra high performance liquid chromatography / mass spectrum device, the overall analysis process is automatically controlled, and is high in accuracy and precision, and the on-line analysis system can be effectively applied to the analysis detection on trace organic compounds in a complicated liquid sample or a liquid extracting solution.