This paper studies a new decentralized resource allocation strategy, named iterative spectrum shaping (ISS), for the multi-carrier-based multiuser communication system, where two coexisting users independently and sequentially update transmit power allocations over parallel subcarriers to maximize their individual transmit rates. Unlike the conventional iterative water-filling (IWF) algorithm that applies the single-user detection (SD) at each users receiver by treating the interference from the other user as additional noise, the proposed ISS algorithm applies multiuser detection techniques to decode both the desired users and interference users messages if it is feasible, thus termed as opportunistic multiuser detection (OMD). Two encoding methods are considered for ISS: One is carrier independent encoding where independent codewords are modulated by different subcarriers for which different decoding methods can be applied; the other is carrier joint encoding where a single codeword is modulated by all the subcarriers for which a single decoder is applied. For each encoding method, this paper presents the associated optimal user power and rate allocation strategy at each iteration of transmit adaptation. It is shown that under many circumstances the proposed ISS algorithm employing OMD is able to achieve substantial throughput gains over the conventional IWF algorithm employing SD for decentralized spectrum sharing. Applications of ISS in cognitive radio communication systems are also discussed.