Owning to complex properties of ergodicity, non-periodic ability and sensitivity to initial states, chaotic systems are widely used in cryptography. In this paper, we propose a sinusoidal--polynomial composite chaotic system (SPCCS), and prove that it satisfies Devaney's definition of chaos: the sensitivity to initial conditions, topological transitivity and density of periodic points. The experimental results show that the SPCCS has better unpredictability and more complex chaotic behavior than the classical chaotic maps. Furthermore, we provide a new image encryption algorithm combining pixel segmentation operation, block chaotic matrix confusing operation, and pixel diffusion operation with the SPCCS. Detailed simulation results verify effectiveness of the proposed image encryption algorithm.