Optical label switching (OLS) is an attractive solution for the packet-based optical switching. A novel OLS method applying spectrum shaping line-coding (SSLC) is proposed in this paper. The label signal is superimposed on the amplitude shift keying (ASK) payload signal by polarization shift keying (PolSK) modulation. The low-frequency component of the payload signal is suppressed by line-coding to reduce the induced crosstalk to the label signal. The payload signal and the label signal could be received separately and directly by an ASK receiver and a PolSK receiver, respectively. The performance of the proposed scheme is tested by simulation. Several line-codes are proposed and compared in the simulation. The results of the simulation test show the feasibility of the proposal. Compared with previous OLS methods, the proposed method increases the code efficiency of the payload signal (from 50% to 75% and 80%) without reducing its extinction ratio (ER). So its effective bit rate is increased while its quality is not sacrificed.