Extracting main melody from polyphonic music is one of the most appealing and challenging tasks in music information retrieval (MIR). In this paper, a new melody extraction method based on a modified Euclidean algorithm (MEA) is proposed. Firstly, the instantaneous frequency is adopted to gain better frequency discrimination, and the frame-wise pitch candidates are estimated based on the modified Euclidean algorithm. Next, the candidate trajectories are formed using these potential candidates, and padded by the candidate one octave above or below if there is a gap at some isolated frames. Finally, the melodic contours are extracted using the melody smoothness and salience principle. The proposed modified Euclidean algorithm can deal with diverse coprime harmonic combinations, and work well at low computational cost and memory requirement. The experimental results show that the proposed method can extract main melody extraction effectively with few pitch candidates.